Learn css (TODO) and csstodo

Source: Internet
Author: User

Learn css (TODO) and csstodo

1. What role is css?
A: css controls the webpage style.
Extension: div + css is a classic web page layout. Separate webpage content from presentation.


2. How does css work?
Answer: 1. inline style: directly add css styles using style attributes in HTML tags

<Div style = "color: red"> red text </div>

2. Embedded: Write the css style in the <style> label of the header.

<Head> <style type = "text/css"> p {color: red ;} </style> 

3. External style: Write css in a separate external file, and then use the <link> label to reference

<Head> <link href = "base.css" rel = "stylesheet" type = "text/css"/> 
Base.css file:
P {color: red ;}

Priority of the three methods: proximity principle

3. css composition?

Answer: Selector + Style

1. selector (separated by commas)

1. Tag Selector

 

p {color: red;}

 

2. id Selector

#test{color:red;}

3. class selector

.test{color:red}

4. derived Selector

TODO

5. Attribute Selector

[title]{color:red}

2. Style

1. Box Model

      

Tip: 1. Apply the background to an area consisting of content, padding, and border.

2. Adding the padding, border, and margin does not affect the size of the content area, but increases the total size of the element box.

2. Positioning

 

  

 

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.