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 -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -