Chapter 4 CSS introduction-water source

Source: Internet
Author: User
Chapter 4 CSS getting started-Water's original learning points:

1. Use CSS

2. Three Methods

3. cascade and inherit

Lecturer: Li Yanhui

This chapter mainly discusses CSS (stacked style sheet) in HTML5, which is used to typeset and format the appearance of HTML documents.

I. UseCSS

A css style consists of one or more style declarations separated by semicolons. Each declared style contains a CSS attribute and a property value.

This is a piece of text.

Description: style is a row style attribute. Color indicates the color attribute, red indicates the color attribute, font-size indicates the font size attribute, and 50px indicates the font size attribute.

Ii. Three Methods

There are three methods to create a CSS style sheet: 1. Embedded style of elements; 2. Embedded style of documents; 3. External style introduction.

1.Embedded element style

This is a piece of text.

Description: Declares the style attribute for the current element.

2.Embedded Document Style

This is a piece of text.

Explanation: InCreate between elements

// External Import

@charset "utf-8";p {  color: green;  font-style: italic;}

If a style is replaced by a style with a higher priority, but you want to execute this style scheme, you can mark this scheme as an important style (important ).

// Forcibly set the highest priority

color: green !important;

3.Style inheritance

If an element does not set a style related to the parent element, the style of the parent element is integrated using the inheritance mechanism.

//Element inherited

Element Style

This isHTML5

Style inheritance only applies to the appearance of elements (text, color, Font, etc.), while the layout style of elements on the page is not inherited. If you inherit this style, you must use forced inheritance: inherit.

// Forcibly inherit the layout style

This isHTML5

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.