html - How can I display first 3 element instead of displaying all css only -


i have code this:

<ul> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> <li>karnataka</li> <li>assam</li> <li>gujarath</li> <li>westbengal</li> </ul> 

and want display first 3 li elements.

this css code may you.

<style>   ul li {     display: none;   }   ul li:nth-child(1), ul li:nth-child(2), ul li:nth-child(3) {     display: list-item;   } </style> 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -