Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: not2easy
If I increase the margin between the image and list to a large enough width, the discs will eventually get pushed into view. However, this causes the rest of the non-list text on the side of the image to get pushed too far away and look a little funny.
Is there some ul value that I'm just not aware of that will easily fix this? Or perhaps something else?
Any help would be greatly appreciated. Thanks.
(2nd post is not your answer as that's what you're trying already!)
a possible downside to that would be that if the list were longer than the image it would not wrap
You can also pull the list bullet "inside" the ul, the default is outside e.g.
, which might help but it's not similar x-browser either and the possible downside with that one is that longer list items wrap under the bullet instead of inline with the line above it.
MarkFilipak - Welcome to WebmasterWorld!
you're almost right about the floats, but the UA's don't insert a <p>. All elements generate Anonymous Inline Boxes [w3.org] (AIB's) it's those anonymous inline boxes which are margined (given clearance) to sit beside floats and allows for wrapping around floats to occur. In the case of a multi line block like a long <p> or a ul with many list items, each line generates a single AIB and is treated separately explicitly for the purpose of wrapping like a long column of text in a newspaper column.
so only the AIB is cleared the block element itself is not and sits underneath the float.
ul's and ol's are already a different case in that their default indent is created by either padding or margin on the UL/OL and their AIB's do not include the bullet unless its position is moved to "inside" so while it's not too hard to get the bullet from under the image, it is hard to get it there with its default indent, the correct way to margin from a float is to margin the floated element itself as Perfection has already tried, but that doesn't help if there's other plain text beside the float too.
Thanks for your greeting. I feel at home here.
You're right. UAs don't insert <p> when they encounter a float, they insert </p>, which is what I wrote. IIRC, they do this only for right floats, not left floats -- or is it the other way around? I've tried to replicate what I've encountered in the past and I can't cook up an example. I can only relate what I've found in the past (read on...)
I had a table cell with text in a p-element that justified the text. I put a float (a float:right, IIRC) in the middle of the text. My innerHTML looked something like this:
<td><p style='text-align:justify;...'>Some text. Some text. Some text. Some <div style='float:right;...'> ... </div>text. Some text. Some text.</p></td>
The text following the float didn't have the p-element's style, it had the table-element's style! When I examined the innerHTML I found this:
<td><p style='text-align:justify;...'>Some text. Some text. Some text. Some </p><div style='float:right;...'> ... </div>text. Some text. Some text.</p></td>
(Note the inserted </p> just before the floated div.) I was amazed!
I changed my source code to eliminate the p-element and move the style into the td-element, to wit:
<td style='text-align:justify;...'>Some text. Some text. Some text. Some <div style='float:right;...'> ... </div>text. Some text. Some text.</td>
and all was happy. (The UA still inserted a </p> just before the floated div, but it didn't have any visual consequence.)
That behaviour you're describing is not float related, it's normal behaviour for HTML parsers.
in HTML certain elements have what's called Optional Closing Tags a <p> is one of them (there are others). The thing is all these "optional" closing tags are still really necessary for the correct rendering of a page and if you don't explicitly insert them, as is your right, a UA will implicitly insert them, that it it will close these elements according to the rules of the HTML.
XHTML requires that ALL elements are closed and it's easier to see (and for me to explain) if you've learned the XHTML way (have you?)
In the case of a <p> the rule is that a UA will implicitly close the </p> as soon as it meets any other block level element. (that includes a div whether floated or not).. if you have learned the XHTML way you will know that makes sense because you cannot nest a block element inside a <p>, therefore the UA is simply following that rule. Although the </p> is optional it still needs to exist in the flow in the correct place and the UA will insert it.
It's not always a simple a rule as that one, e.g. the <head> element also has an optional closing tag.. but the UA knows to implicitly insert </head> right before the opening <body> tag
also </body> and </html> are optional but it doesn't take genius to figure out where they should go ;)
I have an internal toolbar I use which shows at glance which tags are optional or not, but as I learned the (soon to be) old fashioned XHTML way I've always used closing tags.. it has been good practice AND it has helped me understand CSS better so I don't regret it ;)
Thanks again for the help.