![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi. I have a web page which has a left panel and right panel. In the left panel is just several lines of text. In the right panel I want a line of text, and then bulleted indented text. Normally for a line of text and then bulleted indented text you do: p>Paragraph</p ul li>Item1</li li>Item2</li /ul But when there is a left [floated] panel, then the above puts "Paragraph", "Item1", "Item2" right below one another. |
|
In Firefox and Dreamweaver, the bullet point is to the left of "Item1" and "Item2", inside the left panel! |
|
In Internet Explorer (IE), the bullet point does not even show. |
#2
| ||||
| ||||
|
|
The easiest fix in this case, since you know the width of the float, is just: ul { margin-left: 6em; padding-left: 40px } Appendix D of CSS 2.1 suggests margin-left: 40px for ul, although Firefox uses padding by default. But here we want 40px + 6em, which we can achieve by making one of them margin and the other padding. |
|
I should think that might even work in IE. |
|
You could also try list-style-position: inside, which makes the bullet an inline box, meaning it goes to the right of the float (that's what inline boxes, but not what block boxes usually, do). |
|
In Internet Explorer (IE), the bullet point does not even show. It's probably in the same position, but behind the float. Give the float background: transparent and you may see the bullets. |
#3
| |||
| |||
|
|
On Mar 2, 1:14 pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [combining padding and margin, px and em] Thanks, this works in all 3 browsers -- Firefox, IE, Dreamweaver. |
#4
| |||
| |||
|
|
On Mar 2, 1:14 pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: The easiest fix in this case, since you know the width of the float, is just: ul { margin-left: 6em; padding-left: 40px } Appendix D of CSS 2.1 suggests margin-left: 40px for ul, although Firefox uses padding by default. But here we want 40px + 6em, which we can achieve by making one of them margin and the other padding. Thanks, this works in all 3 browsers -- Firefox, IE, Dreamweaver. It's interesting that "margin-left: 6em" means from the left of the page. I would have thought it meant 6em from the right boundary of the left panel. But I guess this way to allow you to put stuff on top of each other! |
|
I should think that might even work in IE. It does. You could also try list-style-position: inside, which makes the bullet an inline box, meaning it goes to the right of the float (that's what inline boxes, but not what block boxes usually, do). The above not work in any browser. That is, I did #page ul { display: inline; } |
#5
| |||
| |||
|
|
removeps-groups (AT) yahoo (DOT) com wrote: On Mar 2, 1:14 pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: The easiest fix in this case, since you know the width of the float, is just: ul { margin-left: 6em; padding-left: 40px } Appendix D of CSS 2.1 suggests margin-left: 40px for ul, although Firefox uses padding by default. But here we want 40px + 6em, which we can achieve by making one of them margin and the other padding. Thanks, this works in all 3 browsers -- Firefox, IE, Dreamweaver. It's interesting that "margin-left: 6em" means from the left of the page. I would have thought it meant 6em from the right boundary of the left panel. But I guess this way to allow you to put stuff on top of each other! No, you are seeing how margins collapse when floats are involved. |
#6
| ||||
| ||||
|
|
This is nothing to do with margin-collapsing (and margin: 6em does not mean 6em from the left of the page either, it means 6em from the left of the container). |
|
A normal block box (in direction: ltr) starts right over at the left of its container. It starts right over at the left even if there happens to be a left float over there. |
|
Inline boxes inside it (e.g. text) are moved to the right to get out of the way of the float. |
|
A list-item is more or less a block box. Its left edge therefore does not move to the right of the float, but stays where it is, over at the left. |
#7
| ||||
| ||||
|
|
On Mar 3, 12:16 am, Ben C <spams... (AT) spam (DOT) eggs> wrote: This is nothing to do with margin-collapsing (and margin: 6em does not mean 6em from the left of the page either, it means 6em from the left of the container). Is the container and page the same thing? My initial thought was that a div is a container, and thus I expected that text-indent: X on the the right panel means X units to the right of the left edge of the div. |
|
A normal block box (in direction: ltr) starts right over at the left of its container. It starts right over at the left even if there happens to be a left float over there. Got it. Inline boxes inside it (e.g. text) are moved to the right to get out of the way of the float. I modified your HTML to add the following: div style="display: inline" This div is display: inline. It looks strange in Firefox. Need to add more lines, so that the text wraps around to see what it looks like. Need to add more lines, so that the text wraps around to see what it looks like. /div The result is that the box is to the right of the left panel, which makes it very much like <div style="overflow: hidden">. However, each line has its own box/border around it (so that in-between the two lines is very thick border), but only the first line has a left border and only the last line has a right border. All lines have top and bottom borders. |
|
A list-item is more or less a block box. Its left edge therefore does not move to the right of the float, but stays where it is, over at the left. Got it. The <div style="overflow: hidden"> was my favorite. Initially I liked the <div style="margin-left: 300px"> approach as it was clear and worked on all browsers. However, I ran into a problem with it. My left panel is only 60ems in height. So in the right panel, if I keep writing more and more stuff, I want the text to wrap around to below the left panel. Something like this where L is the left panel and R is the right panel. LLLL RRRRR LLLL RRRRR LLLL RRRRR RRRRRRRRRR RRRRRRRRRR But with the margin as 300px we don't get the wraparound effect. |
|
Also, in my example I had the margin-left only on the ul, so the normal text did wrap around, but if in the region below the left float I had an unordered list, then it would be super-indented as it would be 14ems from the left of the page, which is fine if there is a left panel present (as then the ul is only 3ems to the right of the left panel), but strange looking below. So I am using <div style="overflow: hidden"> now with text-indent on the ul. .thrColElsHdr #container ul { line-height: 16px; text-indent: 2em; } ... div id="container" style="overflow: hidden" |
![]() |
| Thread Tools | |
| Display Modes | |
| |