What is the difference between ID and class in div

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

        class is the type of label set

        The ID is the identity of the set label

        class property is used to specify what style the element belongs to.

        such as style sheets can be added to

       . Title {

        font-size:14px;

        Font-weight:bold;

       }

        How to: class= the title

        ID property to define a unique style for an element.
&NBSP
        such as a CSS rule:

         #container

        {
         WIDTH:1004PX;
        margin:0 Auto;
        Text-align:left;
       }

        Usage: id= "container", ID is a label that distinguishes between different structures and content, just like your name, if a room has 2 people with the same name , you get confused;

        class is a style that can be nested on any structure and content, like a dress;

         The concept is different:
        ID is to find the structure/content, and then define the style Class is to define a style first, and then set it to multiple structures/content.

        hehe above said already very clear, regardless of ID or class can easily achieve special effects, simple and convenient, hope that this aspect of the people can be enlightened.

        (up to www.zdwx.com)

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.