Use of HTML style sheets

Source: Internet
Author: User

Cascading Style Sheets: CSS cascading style Sheet. V2.1
Controls the appearance of page styles.

One, the style sheet is divided into three categories:
1. Inline style sheet. --placed in the start tag of the element. --only works on the current element.
<input name= "txt" style= "border:0px; border-bottom:1px solid black; "type=" text "/>

2. Inline style sheet. --placed in the ...
<style type= "Text/css" >
Input
{
border:0px;
border-bottom:1px solid red;
}
</style>

3. external style sheet. --Put it in a separate. CSS style sheet file. --can be on the entire site.
(1) Definition of an external style sheet

(2) Invocation of an external style sheet


Second, the style sheet selector:
General syntax for inline, external style sheets:
Selector Selector

style = value;
style = value;
style = value;
....

1. Basic:
(1) Tag selector: Use tag name to select the selector.
Input{...}
Div{...}
Span{...}
Td{...}
(2) Category selector: Use class to categorize elements in HTML elements, and then use the value of this class as the selector.
The name of the. Class {...}
(3) ID Selector: Works on the element for the corresponding ID in HTLM.
#ID的名 {...}
#d1 {font-size:48px;}
#dd {border:5px dotted red;}

2. Compounding:
(1) separated by commas. --side-by-side relations, while working.
Input, #dd,. Yellow,.uu
{
Color:gray;
line-height:28px;

}

(2) separated by a space. --Future relationships.
Div UU
{
Background-color:blue;
}

<input name= "txt" type= "text" class= "UU"/>
<div>
<input name= "txt" type= "text"/>
<input name= "txt" type= "text" class= "UU" value= "******"/>
<span>
<input name= "txt" type= "text" class= "UU" value= "******"/>
</span>
</div>
What is a descendant???

(3) Class two filter.
Tag Selector. class Selector {...}
Input.uu
{
border:5px double red;
}

Cases:

Contrast: Div. UU is different from Div.uu.

Example 1: Inline style Sheets

Example 2: External style sheet

Example 3: Selectors

Example 3 Composite Selector

Use of HTML style sheets

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.