Use two style classes in an HTML element

Source: Internet
Author: User

Typically you can only set a class for one element, but that doesn't mean you can't use two of them.

In fact, you can: <p class= "text side" >...</p>

The P element is also given two classes, the middle is opened with an empty space, so that all text and side two class attributes will be added to the P element. If there are conflicting attributes in their two classes, the latter setting works, that is, the properties of the class that are placed in the CSS file are in effect.
For example: We define two styles first, the first style background is #666, and the second style has a ten px border.
. One{width:200px;background: #666;}
. two{border:10px solid #F00;}
In the page code, we can call this
<div class= "One" ></div>
The final result is that the DIV has both a #666 background and a 10px border.

Use two style classes in an HTML element

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.