CSS Learning (1)

Source: Internet
Author: User

This article Reprinted from Www.admin5.com   CSS (Cascading Style Sheets) Introduction Learning CSS BeforeBefore learning CSS, you should first learn to write HTML. If you do not know anything about HTML, see the HTML tutorial. CSS (Cascading Style Sheets) IntroductionFor example, <p> indicates a paragraph and

Embedded Style (Inline Style)The Inline Style is written in the Tag. The embedded style is only valid for the Tag. <P style = "font-size: 20pt; color: red"> the text in the Style definition <p> </p> is a 20pt font and the font color is red. </P> display example Internal style sheet (Internal Style Sheet)The internal style sheet is written in the HTML External style sheet (External Style Sheet)If many web pages use the same Styles, how can this problem be solved? Write the sample (styles(in a CSS file suffixed with .css, and then reference the CSS file in every webpage that requires these Styles. For example, you can create a home‑called file with the Administrative editor (notepad.pdf, and change the file suffix to .css. The file content is as follows: H1.mylayout {border-width: 1; border: solid; text-align: center; color: red} and then you create a webpage with the Code as follows: <HTML> <HEAD> <link href = ".. /asdocs/css_tutorials/home.css "rel =" stylesheet "type =" text/css "> </HEAD> <BODY> <H1 class =" mylayout "> This title uses Style. </H1> <H1> Style is not used for this title. </H1> </BODY> </HTML> external (Extenal) style sheets have the following advantages over Inline and Internal: · style code can be reused. An external CSS file can be shared by many webpages. · Easy to modify. To modify a style, you only need to modify the CSS file without modifying each webpage. · Improve the speed of web page display. If a style is written on a webpage, the display speed of the webpage is reduced. If a CSS file is referenced on the webpage, most of the CSS files are already in the cache (other webpages have already referenced it ), web page display speed is faster. Series (Cascading)The first letter of CSS is Cascading, which indicates a series. Styles of different sources can be combined to form a style. The order of Cascading is: · browser default (lowest priority) · External Style Sheet (Extenal Style Sheet) · Internal Style Sheet (Internal Style Sheet) · The priorities of embedded Styles are embedded, internal, and external ), browser default ). Suppose there is a font-size: 30pt In the Inline style and a font-size: 12pt in the Internal (Internal) style, then the Inline style will overwrite the Internal (Internal) style. Display example <HTML> <HEAD> <TITLE> Cascading Order </title> <style type = "text/css"> p {font-size: 12pt} </STYLE> </HEAD> <p style = "font-size: 30pt"> overwrite) internal Style Sheet (Internal Style Sheet), the font size is 30pt, not 12pt. </P> </BODY> </HTML>

 

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.