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++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -