Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17548 > unrolled thread

Varying widths according to size of screen

Started bybit-naughty@hotmail.com
First post2017-07-23 11:28 -0700
Last post2017-07-24 10:25 -0500
Articles 4 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  Varying widths according to size of screen bit-naughty@hotmail.com - 2017-07-23 11:28 -0700
    Re: Varying widths according to size of screen "J.O. Aho" <user@example.net> - 2017-07-23 21:30 +0200
    Re: Varying widths according to size of screen Richard Damon <Richard@Damon-Family.org> - 2017-07-23 15:32 -0400
    Re: Varying widths according to size of screen Mark Lloyd <not@mail.invalid> - 2017-07-24 10:25 -0500

#17548 — Varying widths according to size of screen

Frombit-naughty@hotmail.com
Date2017-07-23 11:28 -0700
SubjectVarying widths according to size of screen
Message-ID<7b0f297c-2517-4629-ace6-e896e2d9fcd6@googlegroups.com>
If I have some search results, say, like you get on an E-commerce site, I would like the number of items per line vary according to the size of the screen - eg. if there are 10 say, handbags, if the screen width is short, I would like there to be 4 handbags on the first 2 lines, and 2 on the last one. But if the screen is BIG - then there should be 5 on each line. How do I architect this? (if it's a table they're in, then - tables have <tr>s, not just <td>s, ie. you have to TELL it where each row ends...)

...I'm not sure this is the right group, or the HTML one, or the CSS one, or the MySQL one.... but this LOOKS most appropriate :)


Thanks.

[toc] | [next] | [standalone]


#17549

From"J.O. Aho" <user@example.net>
Date2017-07-23 21:30 +0200
Message-ID<etkbq5F8tpgU1@mid.individual.net>
In reply to#17548
On 07/23/17 20:28, bit-naughty@hotmail.com wrote:
> If I have some search results, say, like you get on an E-commerce site, I would like the number of items per line vary according to the size of the screen - eg. if there are 10 say, handbags, if the screen width is short, I would like there to be 4 handbags on the first 2 lines, and 2 on the last one. But if the screen is BIG - then there should be 5 on each line. How do I architect this? (if it's a table they're in, then - tables have <tr>s, not just <td>s, ie. you have to TELL it where each row ends...)
> 
> ...I'm not sure this is the right group, or the HTML one, or the CSS one, or the MySQL one.... but this LOOKS most appropriate :)

No, you are in the completely wrong group, you should try CSS group and
they tell you how to make div's float.


-- 

 //Aho

[toc] | [prev] | [next] | [standalone]


#17550

FromRichard Damon <Richard@Damon-Family.org>
Date2017-07-23 15:32 -0400
Message-ID<LR6dB.147831$c46.59787@fx03.iad>
In reply to#17548
On 7/23/17 2:28 PM, bit-naughty@hotmail.com wrote:
> If I have some search results, say, like you get on an E-commerce site, I would like the number of items per line vary according to the size of the screen - eg. if there are 10 say, handbags, if the screen width is short, I would like there to be 4 handbags on the first 2 lines, and 2 on the last one. But if the screen is BIG - then there should be 5 on each line. How do I architect this? (if it's a table they're in, then - tables have <tr>s, not just <td>s, ie. you have to TELL it where each row ends...)
> 
> ...I'm not sure this is the right group, or the HTML one, or the CSS one, or the MySQL one.... but this LOOKS most appropriate :)
> 
> 
> Thanks.
> 

The correct answer is you likely want to ask in an CSS group (or as a 
fallback an HTML one) for the best answer, and part of the answer is 
that you DON'T build the results with a table. Formatting via a table 
directives is an ancient method, with the problems like you are 
experiencing.

[toc] | [prev] | [next] | [standalone]


#17551

FromMark Lloyd <not@mail.invalid>
Date2017-07-24 10:25 -0500
Message-ID<2kodB.241101$OD2.133887@fx44.iad>
In reply to#17548
On 07/23/2017 01:28 PM, bit-naughty@hotmail.com wrote:
> If I have some search results, say, like you get on an E-commerce site, I would like the number of items per line vary according to the size of the screen - eg. if there are 10 say, handbags, if the screen width is short, I would like there to be 4 handbags on the first 2 lines, and 2 on the last one. But if the screen is BIG - then there should be 5 on each line. How do I architect this? (if it's a table they're in, then - tables have <tr>s, not just <td>s, ie. you have to TELL it where each row ends...)
> 
> ...I'm not sure this is the right group, or the HTML one, or the CSS one, or the MySQL one.... but this LOOKS most appropriate :)
> 
> 
> Thanks.
> 

You want your code to be responsive to the width of the user's screen 
(or, preferably, browser window). There's a problem in that PHP runs on 
the server and doesn't normally have access to that information.

I use this and have Javascript set a cookie with the window width (and 
height). This can be retrieved and used in PHP. There's still a problem 
in that the cookie won't be available until the next page load, but that 
can be triggered in JS.

Modern browsers also have a CSS setting for columns, which you might be 
able to use.

-- 
Mark Lloyd
http://notstupid.us/

"The deepest sin against the human mind is to believe things without
evidence." -- Thomas Henry Huxley (1825-1895)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web