![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
"mao" <kc.at.sinzon (AT) gmail (DOT) com> wrote in message news:a4551f4c-c451-4095-9a3e-2a1c645e95fd (AT) i29g2000prf (DOT) googlegroups.com... |
|
if I want my CSS use px unit, what is the X value in the following code to have the same result as the one using width:100%? body {width: Xpx;} There is no 1:1 ratio for converting from % to px. It depends on the viewport size of your browser. It is different for different people, depending on their screen resolution, whether their browser is maximised or not, how much chrome/toolbars etc. there are in the browser and a whole bunch of other things. |
#2
| |||
| |||
|
|
Nik Coughlin wrote: "mao" <kc.at.sinzon (AT) gmail (DOT) com> wrote in message news:a4551f4c-c451-4095-9a3e-2a1c645e95fd (AT) i29g2000prf (DOT) googlegroups.com... snip if I want my CSS use px unit, what is the X value in the following code to have the same result as the one using width:100%? body {width: Xpx;} There is no 1:1 ratio for converting from % to px. It depends on the viewport size of your browser. It is different for different people, depending on their screen resolution, whether their browser is maximised or not, how much chrome/toolbars etc. there are in the browser and a whole bunch of other things. Agree. It is a "How many angels can dance on the head of a pin?" type question. |
#3
| |||
| |||
|
|
I think of a "head of the pin" type question as rather more where there is a feint chance of an answer in a debate with rather ill defined terms. |
#4
| |||
| |||
|
|
dorayme wrote: I think of a "head of the pin" type question as rather more where there is a feint chance of an answer in a debate with rather ill defined terms. If that is the case, then we can have an answer of sorts. You create a DIV (or anything else that can be set invisible) and style it to have width:100% |
#5
| |||
| |||
|
|
In article <476617fa$1 (AT) news (DOT) greennet.net>, Steve Swift <Steve.J.Swift (AT) gmail (DOT) com> wrote: dorayme wrote: I think of a "head of the pin" type question as rather more where there is a feint chance of an answer in a debate with rather ill defined terms. If that is the case, then we can have an answer of sorts. You create a DIV (or anything else that can be set invisible) and style it to have width:100% A div is 100% by default. |
#6
| |||
| |||
|
|
On 2007-12-16, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: In article <476617fa$1 (AT) news (DOT) greennet.net>, Steve Swift <Steve.J.Swift (AT) gmail (DOT) com> wrote: dorayme wrote: I think of a "head of the pin" type question as rather more where there is a feint chance of an answer in a debate with rather ill defined terms. If that is the case, then we can have an answer of sorts. You create a DIV (or anything else that can be set invisible) and style it to have width:100% A div is 100% by default. Not exactly. It's width: auto by default. The result of that is that its "used" width will be the available width minus the total width of its left and right margins, padding and borders. But width: 100% makes its used width equal to the available width. So if it has borders, padding and margins that add up to >0, it will overflow its container, resulting in a greater used width than if its width had been left as auto. |
#7
| |||||
| |||||
|
|
Frankly, there are quite a few surprises in the issue when checking different browsers: http://netweaver.com.au/alt/divAuto_...vAuto_v_100per cent.html or http://tinyurl.com/335cmx iCab is different in that the scrollbars disappear after the window is open more than 800px or so? |
|
MacIE leaves a right padding after the right scroll is completed. |
|
Most other modern Mac browsers behave similarly, Opera, FF, Camino, Safari. All end with the black right border *on full scroll* |
|
I shall have to study more closely how the browsers calculate where to place the right float after complete right scrolling occurs. Before any scrolling and no matter how wide the browser window, the right ruler floats to far right flush, that is easier to understand. |
|
And need to look mor closely why the right padding does not also appear *on full right scroll* along with the border. |
#8
| |||
| |||
|
|
On 2007-12-17, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: [...] Frankly, there are quite a few surprises in the issue when checking different browsers: http://netweaver.com.au/alt/divAuto_...vAuto_v_100per cent.html or http://tinyurl.com/335cmx iCab is different in that the scrollbars disappear after the window is open more than 800px or so? Maybe it's not reflowing when the viewport gets wider or something? |
|
MacIE leaves a right padding after the right scroll is completed. A padding on body? That's just wrong as you've set padding on body to 0. |
|
I need to look more closely at why the right padding does not also appear *on full right scroll* along with the border. Which right padding? Div class="demo" has all its padding in place as far as I can see. |
#9
| |||
| |||
|
|
In article <slrnfmccfd.kb3.spamspam (AT) bowser (DOT) marioworld>, Ben C <spamspam (AT) spam (DOT) eggs> wrote: On 2007-12-17, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: [...] Frankly, there are quite a few surprises in the issue when checking different browsers: http://netweaver.com.au/alt/divAuto_...vAuto_v_100per cent.html or http://tinyurl.com/335cmx [...] This is what I am seeing in Safari: http://netweaver.com.au/alt/pics/view_in_Safari.png div.demo has a right-padding of 50px. In Mac IE, this padding is visible on full right scrolling or so it appears to me. Perhaps the makers of Mac IE had the same misconception I have? http://netweaver.com.au/alt/pics/view_in_macIE.png |
#10
| |||
| |||
|
|
On 2007-12-17, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: In article <slrnfmccfd.kb3.spamspam (AT) bowser (DOT) marioworld>, Ben C <spamspam (AT) spam (DOT) eggs> wrote: On 2007-12-17, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote: [...] Frankly, there are quite a few surprises in the issue when checking different browsers: http://netweaver.com.au/alt/divAuto_...vAuto_v_100per cent.html or http://tinyurl.com/335cmx [...] This is what I am seeing in Safari: http://netweaver.com.au/alt/pics/view_in_Safari.png div.demo has a right-padding of 50px. In Mac IE, this padding is visible on full right scrolling or so it appears to me. Perhaps the makers of Mac IE had the same misconception I have? http://netweaver.com.au/alt/pics/view_in_macIE.png The gap between the black border and the right of the viewport looks like not padding but the 50px right margin. |
|
What you have here is an overconstrained situation. You've set the whole lot: margin, border, padding and width, and it all adds up to more than the space available. According to the rules (CSS 2.1 10.3.3) the browser is therefore supposed to disregard what you've set for right margin, and use instead whatever value solves the equation: margin + padding + borders + width = available width Mac IE is getting this wrong-- it's giving you less of something else instead, perhaps of width. Suppose the available with is 600, then we've got: 50 + 50 + 50 + 50 + 50 + mr + 600 = 600 pl pr bl br ml mr width available pl means "padding left" etc. Therefore the "used" value of mr (margin-right) has to be -250. In other words, you actually get a right margin of -250px even though you asked for one of 50px. The browser tries to give you what you ask for, but where that isn't logically possible, it has to make the specified compromises. (Note that if direction were rtl, it would be the left margin that ended up as -250). MacIE appears to be drawing this right margin as +50px. That's wrong according to today's specifications. |
![]() |
| Thread Tools | |
| Display Modes | |
| |