简体   繁体   中英

html ul style css for bullet

I've following the code.
But there is no style for ul in the class "listStyle".

 .listStyle { color: red; } .listStyle p { color: black; } ul li{list-style-type:none;} .liststyle ul, .liststyle li{list-style-type:circle;list-style:circle;display:inline;} 
 <ul class="listStyle"> <li> <p><strong>View :</strong> blah blah.</p> </li> <li> <p><strong>View :</strong> blah blah.</p> </li> </ul> 

I want to set the circle style for ul that has class "listStyle".
And the rest has to be have none style.
What do I have to fix?
Thanks

If you write list-style-type: none you are rejecting the bullet. Remove it and it works.

EDIT

You can reset the list style type for the classname. see edited snippet. And not that CSS is case sensitive. liststyle !== listStyle

 .listStyle { color: red; } .listStyle p { color: black; } ul li{list-style-type:none;} .listStyle, .listStyle li { list-style-type: circle; } 
 <ul class="listStyle"> <li> <p><strong>View :</strong> blah blah.</p> </li> <li> <p><strong>View :</strong> blah blah.</p> </li> </ul> 

There where two little mistakes in your code:

  1. upper and lower case must be same in HTML and CSS
  2. if your <ul> has a class like <ul class="list-style"> then the CSS is ul.list-style

 .listStyle { color: red; } .listStyle p { color: black; } ul li { list-style-type:none; } ul.listStyle li { list-style-type: disc; } 
 <ul class="listStyle"> <li> <p><strong>View :</strong> blah blah.</p> </li> <li> <p><strong>View :</strong> blah blah.</p> </li> </ul> <ul> <li>list with no bullets</li> <li>list with no bullets</li> <li>list with no bullets</li> <li>list with no bullets</li> </ul> 

 .listStyle { color: red; } .listStyle p { color: black; } .nostyle{list-style:none;} .liststyle ul, .liststyle li{list-style-type:circle;} 
 <ul class="listStyle"> <li> <p><strong>View :</strong> blah blah.</p> </li> <li class="nostyle"> <p><strong>View :</strong> blah blah.</p> </li> </ul> 

itz working ... if you not want list style mean list-style: none

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM