Display the only first item of a list

3185 views html
10

I was wondering how to display only the first item in a list and make all the other items in the list hidden.

<ul id="list">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>

ul[id="list"] {
  color: black;
  display: none;
  position: absolute;
  font-size: 30px;
}

ul[id="list"]:nth-of-type(1) {
  color: black;
  display: block;
  position: absolute;
  font-size: 30px;
}

answered question
Add a Comment

0 Answer

Please login first before posting an answer.

Ads

Categories