![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, There is a little problem with the header on the page I recently converted from frames to proper HTML+CSS. The top part with the navigation used to be the top frame but is now included via SSI. On a broad screen, it looks good, but if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ I experimented with the following: - put the slogan line between the floats. This results in the right float being pushed down - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. So what I want is that the slogan is nicely centered between the floats, both vertically and horizontally, but that it doesn’t overlap with the line below if the viewport gets small. I do not really understand why clear:both on the line doesn’t work as expected. float: center; would be the solution, but this doesn’t exist. |
#3
| |||
| |||
|
|
In article <gcne0g$so3$1 (AT) newsserv (DOT) zdv.uni-tuebingen.de>, Hendrik Maryns <gtw37bn02 (AT) sneakemail (DOT) com> wrote: Hi, There is a little problem with the header on the page I recently converted from frames to proper HTML+CSS. The top part with the navigation used to be the top frame but is now included via SSI. On a broad screen, it looks good, but if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ I experimented with the following: - put the slogan line between the floats. This results in the right float being pushed down - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. So what I want is that the slogan is nicely centered between the floats, both vertically and horizontally, but that it doesn’t overlap with the line below if the viewport gets small. I do not really understand why clear:both on the line doesn’t work as expected. float: center; would be the solution, but this doesn’t exist. You could set a min-width so that, if the viewport is shrunk, you don't observe the behaviour (the user gets a horizontal scroll-bar instead) |
|
As far as three things on the same line, you can have two left floats (#logo, #slogan) and leave the right content in the main flow. |
#4
| |||
| |||
|
|
if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. |
|
I do not really understand why clear:both on the line doesn’t work as expected. |
#5
| |||
| |||
|
|
David Stone schreef: In article <gcne0g$so3$1 (AT) newsserv (DOT) zdv.uni-tuebingen.de>, Hendrik Maryns <gtw37bn02 (AT) sneakemail (DOT) com> wrote: Hi, There is a little problem with the header on the page I recently converted from frames to proper HTML+CSS. The top part with the navigation used to be the top frame but is now included via SSI. On a broad screen, it looks good, but if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ I experimented with the following: - put the slogan line between the floats. This results in the right float being pushed down - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. So what I want is that the slogan is nicely centered between the floats, both vertically and horizontally, but that it doesn't overlap with the line below if the viewport gets small. I do not really understand why clear:both on the line doesn't work as expected. float: center; would be the solution, but this doesn't exist. You could set a min-width so that, if the viewport is shrunk, you don't observe the behaviour (the user gets a horizontal scroll-bar instead) Sorry, but doesn't work (a scroll-bar, yes, but the text is still wrapped). As far as three things on the same line, you can have two left floats (#logo, #slogan) and leave the right content in the main flow. Myes, but I'd like a big enough gap between the floats. And specifying an explicit margin/padding will give similar problems with small viewports. Thanks anyway, H. |
#6
| |||
| |||
|
|
Hendrik Maryns wrote: if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. Margins are subject to margin collapsing rules, which affects spacing of elements around it. Margins and floats can be even trickier. I do not really understand why clear:both on the line doesn’t work as expected. Relative positioning does not do what you probably think it does - it offsets the element's position without affecting the other elements around it. That's why the line doesn't shift down when the slogan line wraps - it behaves as though slogan is staticly positioned. http://brainjar.com/css/positioning/ Go back to static positioning on slogan, but try padding-top:1em instead of margin-top, then you'll avoid the margin collapsing issues. |
#7
| |||
| |||
|
|
Hendrik Maryns wrote: if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/ - instead of position:relative and top:1em (they belong together, obviously, the one does nothing without the other), tried margin-top: 1 em, but that shifts the floats down as well. Margins are subject to margin collapsing rules, which affects spacing of elements around it. Margins and floats can be even trickier. I do not really understand why clear:both on the line doesn’t work as expected. Relative positioning does not do what you probably think it does - it offsets the element's position without affecting the other elements around it. That's why the line doesn't shift down when the slogan line wraps - it behaves as though slogan is staticly positioned. http://brainjar.com/css/positioning/ Go back to static positioning on slogan, but try padding-top:1em instead of margin-top, then you'll avoid the margin collapsing issues. |
#8
| |||
| |||
|
|
I?ve had a shot at it now, but there is still one problem: if the text gets wrapped, the padding-top is no longer wanted. I want it to be *vertically centered* between the two floats. Is there really no way to achieve this? |
|
WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance | by the abuse department, bellsouth.net is blocked. If you post to | Usenet from these places, find another Usenet provider ASAP. | Phil Howard KA9WGN (email for humans: first name in lower case at ipal.net) | |
#9
| |||
| |||
|
|
On Sat, 11 Oct 2008 14:00:59 +0200 Hendrik Maryns <ialpjx302 (AT) sneakemail (DOT) com> wrote: | I?ve had a shot at it now, but there is still one problem: if the text | gets wrapped, the padding-top is no longer wanted. I want it to be | *vertically centered* between the two floats. Is there really no way to | achieve this? You have taller things on one or the other side of something, or both, and you want the shorter thing to be aligned vertically so the middle match up. You can't just code some padding in a box because you don't know how tall these things will be rendered in the browser. I've seen quite a number of hacks on achieving this by many advocates who (often strongly) urge people to avoid using markup tables to do layouts. None of them work completely or correctly. Layouts using tables is "wrong" but it still works. CSS2 has display modes to mimic tables but this is not widely implemented (reportedly unsupported in IE). Where I find I cannot achieve the desired layout in CSS, I revert back to the old time hack of using tables. |
#10
| |||
| |||
|
|
On Sat, 11 Oct 2008 14:00:59 +0200 Hendrik Maryns <ialpjx302 (AT) sneakemail (DOT) com wrote: | I?ve had a shot at it now, but there is still one problem: if the text | gets wrapped, the padding-top is no longer wanted. I want it to be | *vertically centered* between the two floats. Is there really no way to | achieve this? You have taller things on one or the other side of something, or both, and you want the shorter thing to be aligned vertically so the middle match up. You can't just code some padding in a box because you don't know how tall these things will be rendered in the browser. I've seen quite a number of hacks on achieving this by many advocates who (often strongly) urge people to avoid using markup tables to do layouts. None of them work completely or correctly. Layouts using tables is "wrong" but it still works. CSS2 has display modes to mimic tables but this is not widely implemented (reportedly unsupported in IE). Where I find I cannot achieve the desired layout in CSS, I revert back to the old time hack of using tables. |
![]() |
| Thread Tools | |
| Display Modes | |
| |