Basics of getting Started with CSS

Source: Internet
Author: User

    • Understanding CSS
    • Disadvantages of traditional HTML design page layouts
    • Features of CSS
    • CSS layout style

13.1 Understanding CSS

The English full name of the CSS is cascading style Sheets, Chinese can be translated into a threaded style, and the CSS2 specification was also approved and recommended in February 1998, so CSS is not designed for XHTML, CSS can also be used in other markup language to make typesetting samples, such as html,xml files can be applied to CSS, to beautify the design of the Web page, if you learn CSS, in the Html,xhtml,xml file can use.

13.2 Disadvantages of traditional HTML design page layouts

Using traditional HTML control tags to design a Web page is inherently impossible to compare with a typographic sample, because HTML is not entirely focused on the functionality of page layouts, which is especially true for XHTML, because XHTML intentionally abandons the markup or attributes of the page layout in the original HTML, as <font>,<center>,color,background,bgcolor and so on, so for the XHTML file, its layout and display function is weaker than the HTML file, So using XHTML to design a Web page requires a combination of CSS layout samples.

features of 13.3 css

Disadvantages of HTML typesetting:

Setup trouble, modify the trouble, the function is seriously insufficient.

Advantages of CSS style typography:

The Layout property function is complete, the typesetting file can exist independently, can share the typesetting file

Categories of CSS style typography:

Expert typesetting style, inline layout style, and linked typesetting

13.4 CSS Layout style

Inline layout style:

Format:< Tag Name style= "Property 1: Property value 1; Property 2: Property value 2" >...</tag name >

Example: <p style= "Font-size:20pt;color:red;text-align:center" > Typesetting style </p>

Typesetting special marking:<div> and <span>

Div the occupied position is a row, span Occupy how wide the content is, and how wide the space is.

The most obvious difference between the two is DIV is a block element, and SPAN is the inline element ( also translated inline elements ) .

Detailed:1. The so-called block element, is the element that starts to render in another line, the inline element does not need another line, test the following code you will have a more visual understanding:

test <SPAN> immediately preceding " test " display </SPAN><DIV> here will be another line showing </div>

2. Block elements and inline elements are also not immutable, by defining css display

Test <div style= "Display:inline" > Follow the previous " Test " Show </div><span style= "Display:block" > there will be another line here . </span>

Inline Typesetting Sample:

All style definitions in the inline layout must be in <style> </style> between, and <style> </style> must be in

And its function can be divided into three kinds,

    1. Tag Definition type
    2. class-Defined
    3. ID Definition Type

Tag-defined format:

<style type= "Text/css" >

Tag name {

Attribute 1: Attribute value 1;

Attribute 2: Attribute value 2;

}

Tag name {

Attribute 1: Attribute value 2;

Attribute 2: Attribute value 2;

}

</style>

<body>

< tag name >...</tag name >

</body>

Class-defined format (multiple use):

<style type= "Text/css" >

. Define Name {

Attribute 1: Attribute value 1;

Attribute 2: Attribute value 2;

}

. Define name 1,. Define Name 2{

Attribute 1: Attribute value 1;

Attribute 2: Attribute value 2;

}

</style>

<body>

< tag name class= "Definition name" >...</tag name >

</body>

ID-defined format (unique use):

<style>

#定义名称 {

Attribute 1: Attribute value 1;

Attribute 2: Attribute value 2;

}

#定义名称1, #定义名称2 {

Attribute 1: Attribute value 1;

Attribute 2: Attribute value 2;

}

</style>

<body>

< tag name id= "Definition name" >...</tag name >

</body>

Priority of "inline" and "in-line" typographic definitions:

CSS rules, the smaller the scope, the higher the priority.

Arranged by small to large:

    1. in-line
    2. class and ID definition type
    3. Tag Definition line

The priority of the ID is higher than the class class.

External layout style definition:

Stand-alone style layout:

Tag name {Attribute 1: Property value 1; Property 2: Property value 2;}

. definition name {Attribute 1: Property value 1; Property 2: Property value 2;}

Use between

Format:

<link rel= "stylesheet" type= "Text/css" Href=url/>

Use import between

Format:

<style type= "Text/css" >

@import "Style.css"

</style>

Basics of getting Started with CSS

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.