Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS: Inheritance 2

Status
Not open for further replies.

sonnysavage

Programmer
May 29, 2002
130
US
I've got some CSS that looks like this:
Code:
ul.style li { border: 2px solid #000; }
li.one { border-bottom: none; }
li.two { }
li.three { }

The problem I'm experiencing is why the "
Code:
li.one
" class does NOT override the "
Code:
ul.style li
" declaration. Can anyone shed some light on this? [pc2]
 
Try this:
Code:
ul.style li { border: 2px solid #000; }
.style li.one { border-bottom: none; }
li.two { }
li.three { }
Hope this helps.
 
Great CSS reference/tut:
Since IE still doesn't support a lot of CSS the following is probably no use to you, but worth considering for the future (in Firebird the first <li> doesn't get a bottom border):
Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd&quot;>[/URL]
<html>
<head>
<title>Test Bed</title>
<style type=&quot;text/css&quot;>
ul.style li { border: 2px solid #000; }
ul.style li:first-child { border-bottom: none; }
</style>
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
</script>
</head>
<body>
Unordered List:
<ul class=&quot;style&quot;>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ul>
</body>
</html>

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top