Home > Web Front-end > HTML Tutorial > A problem encountered when learning HTML and css_html/css_WEB-ITnose

A problem encountered when learning HTML and css_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:42:59
Original
995 people have browsed it






When css is defined
.user_wrap { width: 160px; padding-bottom : 30px; position: relative; }
.clear { zoom:1; }
Please tell me why that class name can be defined separately.
Note: This example can be run, but I don’t know why its principle can be defined in this way.


Reply to discussion (solution)

There can be multiple classes, and the later ones have higher priority

I know! There can be multiple classes, but for this problem, he only defined one class name "user_wrap clear" and when using it, he can split the class name and use it. Is it related to the space?

Well . . . Yes, multiple class names should be separated by spaces. For example, if there are three class names .a .b .c , when you use them, just use class="a b c ". The later, the higher its priority. high. For example, you use a b c to define three different colors, and then only display the color of c. . You can try

"user_wrap clear" does not define only one class name, but two

A div can use many classes at the same time, and the difference class needs to be added at the end Space. Like what was said on the 3rd floor.
Because classes can be shared by many divs, so

if written like this, it may be that other divs in the page need to use the .user_wrap class, and clear is just This div needs to be added before being used.

Thank you everyone!

A div can use many classes at the same time, and spaces need to be added at the end to distinguish classes. Like what was said on the 3rd floor.
Because classes can be shared by many divs, so

if written like this, it may be that other divs in the page need to use the .user_wrap class, and clear is just This div needs to be added before being used.


Thank you everyone! I understand
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template