CSS language notes & lt; 1 & gt; and css language notes

Source: Internet
Author: User

CSS language notes <1>. css language notes
CSS (Cascading Style Sheets) Chinese: stacked style sheet Syntax: <style type = ""> </Style>

Instance:

<style type="text/css">a{  color:red;  text-align:center;  font-size:24px; }</style>
Selector id Selector

The HTML Tag attribute sets the selector based on the id, and "#" is selected in CSS.

For example, <a id = "a"> a text </a>

The methods shown in the following figure are selected.
Instance:

<style type="text/css">#a{  color:red;  text-align:center;  font-size:24px;    }</style>
Class Selector

If the class selector is used, the expression is ".". Unlike the id selector, the class selector can be used in multiple HTML tags.

For example, <a class = "qqq"> a text </a>

<P class = "qqq"> text </p>

Instance:

<style type="text/css">.qqq{    color:red;    text-align:center;    font-size:24px;        }</style>

The second method indicates the qqq element under tag.

<style type="text/css">a.qqq{   color:red;   text-align:center;   font-size:24px;       }</style>
Multi-element Selector

Instance:

<style type="text/css">a,b,c,d{        color:#FFFFFF;        text-align:center;        font-size:24px;        }</style>
Descendant element Selector

Select the li element under instance a. The child element is selected with spaces.

Instance:

<style type="text/css">.a li{       color:red;      }</style>
Child element Selector

The child element is the same element in the class and has a parent-child relationship. Expressed with a greater than sign

Instance:

<style type="text/css">.a > .title{                color:#FF6300               }</style>

 

 

 

Summary

The id is unique and the class is versatile.

 

To be continued .............

 

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.