See the code below? Why doesn't list-style:none work?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> body{ list-style:none; } </style> </head> <body> <ul> <li> aaaaaa </li> <li> bbbbbb </li> </ul> </body> </html>
The default level of ul is not as high.
Why should it be set on the body?
If you set it on the body, then the subsequent ul will inherit the settings of this body. The inherited things will be overwritten by the properties carried by itself. of.
What a complicated question~
Can you understand it this way:
The default style of ul belongs to the inline style sheet
The body{...} in the head tag belongs to the internal style sheet
And the priority of the internal style sheet is lower than that of the inline style sheet
If it is not reflected, it is best to add it to the css style in the div, which is the most stable
Written on the body, it can theoretically be inherited by elements in the body, but the permissions inherited in CSS are the lowest, so it will be overwritten by UL's own default style. Such code is generally written directly to UL
ul{ list-style:none; }
The above is the detailed content of Why does list-style:none in css not work?. For more information, please follow other related articles on the PHP Chinese website!