DIV + CSS learning summary, divcss Summary

Source: Internet
Author: User

DIV + CSS learning summary, divcss Summary

DIV + CSS is the WEB design standard. It is a WEB page layout method. Unlike traditional table layout positioning, it can separate webpage pages from presentation.

Because there are a lot of contacts with CSS in niujiao and JS. Now, when I study DIV + CSS again, I am no longer familiar with it. It is a resonance ~~

No matter how you set CSS stylesSelectorAndStyle Sheet.

Style Sheet

There are three main types of style sheets. These are embedded style sheets, external style sheets, and inline style sheets.

Embedded style sheet

Add a style sheet between html

Example:

<Head> <title> example </title> <style type = "text/css"> # color {font-color: red ;}</style> 

Inline style sheet

Insert a style directly into an html Tag

Example:

<H1 style = "color: red"> example External style sheet

Create a new CSS file and insert it into the HTML code using the link statement.

Example:

<Link type = "text/css" rel = "stylesheet" href = "css/ ..css"/>
Selector

There are also three commonly used selectors: ID selector, class selector, and tag selector.

ID Selector

In HTML, you can add an ID to the element to determine its position. At the same time, the ID must be unique and cannot be repeated. You can set a style for the tag by using the ID.

Example:

Set a color id for the p tag.

<P id = "color"> example </p>

The css id selector is used to change the color of the content in the <p> label.

#color{font-color:red;}
Class Selector

In HTML, you can add class attributes to tags and set attributes for tags through class.

Example:

Set a class called color for the p tag.

<P class = "color"> example </p>

The css class selector is used to change the color of the content in the <p> label.

.color{font-color:red;}
Tag Selector

Change the style of the content in the tag Based on the HTML Tag.

Example:

Change the text color of the <p> label

<P> example </p>

Use the tag selector to change the text color in the <p> label.

P{color:red;}
Summary

Selector and style sheet are the most basic content in CSS. With these skills, you are more comfortable with learning other things.

During video learning, I also learned the comprehensive use of CSS, JavaScript, CSS, XML, CSS, and Ajax. However, I do not know much about it. I still need to practice more to further deepen my understanding.

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.