This is not an effective use of % as the parent div is fixed width anyway. Ideally you want the parent div to be 100% and the right bar (advert) div to be fixed width, whilst the left_pane (content) responds to the display width. So you need to decide what range of overall widths you wish to support (say 480px to 1024px), the width of the fixed bar (say 240px), then do some maths to work out what % of the width is available for the content. I.e.:
Originally Posted by scottjsn
% = (min-width - fixed-bar) x 100 / min-width.
Which, with the suggested figures is (480 - 240) x 100 / 480 = 50%.
Using % in this way is the simplest way of making the width responsive, but is not the best. Why? because it does not maximize the screen usage on medium resolution displays. E.g. In the above example:
- On a screen or window 1024px wide it uses only 1024 x 50% + 240 = 752px, leaving 272px blank (i.e. there would be a blank border of 186px either side).
- The maximum of 1024px width is reached at (1024 -240) * 2 = 1568px screen or window width.
This is an acceptable performance, but, given that the most commonly used screen display used to view the web (according to w3counter) is 1366px wide, and less than 10% of web browsing is done on screens of 1600px or wider, this is not optimal.
To maximize the screen usage on medium resolution displays, you need to use either (or both):
- Position: absolute, and/or
- Media specific style sheets or media queries.
Last edited by jedaisoul; 02-26-2014 at 06:24 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)