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
Post a Comment