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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -