Need some help with a CSS style

F

Froefel

I'm trying to achieve the following result, related to vertical
spacing around text:

<OL class="level1">
<LI>
<OL class="level2">
<LI></LI>
</OL>
</LI>
</OL>

I need to get 1.5em of space after each LI within OL level1
I need to get 5px of space before each LI within OL level 2

I have written the following stylesheet to achieve this:
ol.level1 { list-style: decimal; margin-left: 2em; padding-left: 0; }
ol.level2 { list-style: disc; margin-left: 1.25em; padding-left: 0;
padding-top: 0; text-indent: 0; }
ol.level1>li { padding-bottom: 1.5em; }
ol.level2 li { padding-top: 5px; }

Problem is: this renders perfectly in FireFox 2.0.0.4, but in IE 6.0
it doesn't render the 1.5em vertical space

Replacing the third style with li.level1 { padding-bottom: 1.5em; }
and adding class="level1" to each <LI> within OL level1 achieves the
proper result in IE 6.0, but then FireFox doesn't render the desired
result.

Is there an elegant way to achieve the desired result in both
browsers, without the need for conditional styles?

Any help is greatly appreciated!

-- Hans De Schryver
 
A

Andy Dingley

Is there an elegant way to achieve the desired result in both
browsers, without the need for conditional styles?

I haven't looked at your example in detail, but AFAIR the default
stylesheets for lists are significiantly different between IE and FF.
One uses margin to achieve the indents, the other uses padding.

So if you want consistent results, and you change _anything_, then
always change _everything_.
That means approximately 16 CSS values: margin and padding on all four
edges of both elements.
(There might be some you can skip, but I can't remember the details to
that level).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top