简体   繁体   中英

How to remove the particular CSS style (set through CSS file) from an HTML list

I have applied following styles on HTML list in my CSS file

list-style-image: none;
list-style-type: none;

But then, in a page I want to have items listed in an alphabetical order (means an OL list). But when I write the <ol type="a">...</ol> then items are not displayed in ordered-list manner, because I think the style set in CSS file through above mentioned properties affects it.

So can anyone tell what the problem really is and how to solve it. Is there any way to remove that CSS property (list-style-type: none;) so that the items are show in normal way.

You can apply the rule only to ul like this:

ul {
    list-style-image: none;
    list-style-type: none;
}

list-style-image and list-style-type have nothing to do with ordering alphabetically. These set the style of the list eg bullet and the image to use for the bullet. In regards to overriding the css this will work:

Give your ol a class and set it to whatever you wish.

<ol class="different-ol-style">...</ol>

.different-ol-style{
list-style-type:lower-alpha;
}

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