Site css and responsiveness and max width question
born2run
11:52 pm on Feb 25, 2018 (gmt 0)
Hi, so I am setting a new site design with CSS.
I wanted to know would 100% width be better or say, setting a max-width of 1600px be advisable?
That would take care of the large monitors no? Kindly advise. Thanks!
lucy24
4:56 am on Feb 26, 2018 (gmt 0)
Width of what? Pictures can be infinitely wide, but any text areas need a max-width in ems or it will be unreadable.
born2run
5:07 am on Feb 26, 2018 (gmt 0)
Width of all the pages of my site.. i've setup for 100% but I've been advised to set max-width of all the pages to 1600px
not2easy
5:59 am on Feb 26, 2018 (gmt 0)
Good idea, especially if there are lines of text on the page. It can be difficult to read long lines of text. Even better to break the width into columns of content that can nest the least critical parts of content under the main content at narrower widths.
An example is this page - you can stretch it across an extra wide monitor, but it gets hard to read. The sidebar gets wider, but the lines are still too long for comfortable reading. I may be wrong but I would think it is rare that anyone would want to see pages wider than 1600 px - unless for videos.
born2run
3:34 pm on Feb 26, 2018 (gmt 0)
So what's the css code? I have following:
#somediv { width: 100%; max-width: 1600px; }
Peter_S
4:59 pm on Feb 26, 2018 (gmt 0)
You might want to add "margin:auto;" if you want the div to be centered. but all depends of the surrounding elements.
lucy24
9:39 pm on Feb 26, 2018 (gmt 0)
width: 100%;
There is no need for this unless you're overriding some higher-level setting. A width of 100% is the default for almost everything.
Be sure to test in different browsers, because some get confused when you have both a "width" and a "max-width" (or "min-width") declaration applied to the same element.