Example of a CSS element with multiple class selectors

Source: Internet
Author: User

An element can have multiple class selectors at the same time. Note that when multiple class selectors are conflicting, the last class selector in the CSS file has the highest precedence.

In the following example,,<div> has CLS1 and cls2 two class selectors, note that they are written in order to be separated by a space in a class identifier.

Cases:

HTML file:



<title> an element has multiple class selectors at the same time </title>
<link rel= "stylesheet" type= "Text/css" href= "Test.css"/>
<body>
<div class= "Cls1 cls2" > Thank you for visiting www.bianceng.cn, I hope to help you! </div>
</body>

Content of Test.css:

/* An element has multiple class selectors at the same time.
. cls1{
color:red;
font-size:40px;
Font-style:italic;
Text-decoration:none;
}
. cls2{
Color:blue;
Font-weight:bold;
Text-decoration:underline;
}

The effect of the following figure:

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/Css/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.