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


Groups > comp.lang.php > #17551

Re: Varying widths according to size of screen

Subject Re: Varying widths according to size of screen
Newsgroups comp.lang.php
References <7b0f297c-2517-4629-ace6-e896e2d9fcd6@googlegroups.com>
From Mark Lloyd <not@mail.invalid>
Message-ID <2kodB.241101$OD2.133887@fx44.iad> (permalink)
Organization Newshosting.com - Highest quality at a great price! www.newshosting.com
Date 2017-07-24 10:25 -0500

Show all headers | View raw


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)

Back to comp.lang.php | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

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

csiph-web