. NET Learning notes----2015-07-14 (CSS Write)

Source: Internet
Author: User

1, CSS is cascading style sheet abbreviation, Chinese meaning: Cascading style sheet.

CSS allows web page creators to effectively customize and improve the effect of web pages. CSS is a complement to HTML

CSS enables a complete separation of Web content and page effects

Ctrl+j Popup Smart Tips

2, CSS several ways to set up

There are three ways to add style sheets to an HTML document, each with its own pros and cons

1), inline style sheet (sets the style of the element within the tag)

2), embed style sheet (need to write in head tag <style type= "Text/css" ></style>)

3), external style sheet link

<!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/>    <title></title>    <Linkhref= "Testcss.css"rel= "stylesheet" />    <styletype= "Text/css">P{background:Yellow;font-size:Xx-small;        }    </style></Head><Body>    <Pstyle= "background:red; Font-size:xx-large">The weather is fine today, the steamer is everywhere.</P>    <P>The weather is fine today, the steamer is everywhere.</P>    <P>The weather is fine today, the steamer is everywhere.</P>    <P>The weather is fine today, the steamer is everywhere.</P>    <TT>The moonlight before the bed, suspected to be ground frost</TT></Body></HTML>

3. Style Rule selector (what is the way to get the elements on the page to set the style)

1), HTML Selector

2), Class Selector (you need to assign a value to the class property of the element you want to set the style to)

3), ID Selector (need to assign a value to the id attribute of the element to set the style)

4), association selector Pem{background-color:yellow}

5), combination selector <table></table>

6), pseudo-element selector

A pseudo-element selector is a way of defining the various states of the same HTML element and part of the content that it contains. For example, for the normal state of the hyperlink label <a></a> (no action before),

The status of the visited state, the selected state, the cursor moves to the status on the hyperlink text, and for the first and first lines of the paragraph, you can use the pseudo element selector to define

There are several common ones:

A:active status when a hyperlink is selected

A:hover the cursor moves to the state on the hyperlink

A:link Normal status of hyperlinks

a:visited the status of hyperlinks visited

P:first-line the first line of text in a paragraph

P:first-letter the first letter in a paragraph

. NET Learning notes----2015-07-14 (CSS Write)

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.