I wrote this code:
CSS:
#header {
margin: 0;
background:gray;
}
#tabs {
color:yellow;
font-weight: bolder;
display:inline;
}
HTML:
<div id="header">
<h1>Tabs</h1>
<ul id="tabs">
<li id="tabs"><a href="#">This</a></li>
<li id="tabs"><a href="#">That</a></li>
<li id="tabs"><a href="#">The Other</a></li>
<li id="tabs"><a href="#">Banana</a></li>
</ul>
</div>
But the yellow font color is not being applied to the li items. Why is this happening? And how should I write this code in order to get correct output?
If you have multiple elements with the same ID, it’ll usually apply to only the first one. Elements should have unique IDs. Use classes instead.
From The global structure of an HTML document:
So your code should look like this:
#for ID,.for class. Multiple elements can have the same class. You also want to change the link color of thelis so specify that in the CSS: