(a) primary knowledge of DIV+CSS

Source: Internet
Author: User

As for Div+css, he has always been listening to his name and not knowing why. Today saw a half-day video, finally on this slightly understand, feel very good, compared to the table layout page, Div+css is a page layout tool!!

Div Full Name Division (split, split, department), CSS full name cascading style sheet (cascading style sheet)

The layout of the Web page is divided into three periods: table layout, table+css layout (transition), div+css layout (current mainstream)

Relative to the DIV+CSS layout, table layout disadvantages: 1, display style and data binding together, 2, the flexibility of the layout is not high;

3, a large number of <table> tags, resulting in code redundancy, 4, large bandwidth; 5, the search engine does not like

Advantages: 1, understanding is relatively simple, 2, different browsers, display the same results; 3, the display data is very good

After a brief description of DIV+CSS, how do you use them?

Using CSS, you need a little more common selector for CSS:

1. Class selector: Defines the format (. class1{Property 1: Value; property 2: value;} )

Citation format: <div class= "Class1" > </div>

2. ID Selector: Defines the format (#id1 {attribute 1: value; property 2: value;} )

Citation format: <div id= "ID1" > </div>

3. HTML element selector: Defines the format (element {attribute 1: value; property 2: value;} )

Reference format:< element ></element >

4. Wildcard selector: Define format (*{attribute 1: Value; property 2: value;} )

Apply to all content within a page

5. Parent-Child selector: Define the format (. Class1 span{Property 1: Value; property 2: value;} Or. Id1 span{Property 1: Value; property 2: value;} )

<div class= "Class1" or id= "ID1" > No <span> discard </span> no <span> discard </span></div>

Note: Parent-child selectors cannot have too many series

Selector priority: I-D selector > class selector >html element selector > wildcard selector

After the CSS is constructed, how do you refer to it in an HTML file?

There are three ways of referencing CSS in HTML:

1. External style sheet:

<link rel= "stylesheet" type= "Text/css" href= "name 1.css"/>

<link rel= "stylesheet" type= "Text/css" href= "name 2.css"/>

<link rel= "stylesheet" type= "Text/css" href= "name 3.css"/>

2. Internal style sheet

<style type= "Text/css" >

body{Property 1: Value; property 2: value;}

p{Property 1: Value; property 2: value;}

</style>

3. Inline style sheet

<p style= "attribute 1: value; Attribute 2: Value "></p>

Precedence: inline style sheet > internal style sheet > external style sheet

CSS file, if more than one selector has the same property value, how to do it, or how does a CSS file introduce another CSS file?

1. If more than one selector in a CSS file has the same attribute value

. Class1, #id1, p{property 1: Value; property 2: value;} /* Merge the same attributes */

2. One CSS file to introduce another CSS file

@import URL ()/* Import multiple CSS files into a CSS file, and now usually use the link method */

The use of the basic CSS is these, about the properties of the settings there is a lot of content, because just beginning to learn, know less of the attributes, it seems that this part of the main rely on the search Help document to memorize.

                     

(a) primary knowledge of DIV+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.