CSS Basics 1--CSS style sheets and style rules

Source: Internet
Author: User

1,CSS (cascading style Sheets) cascading style sheet . Used to define the display form of HTML elements, which is the standard technique for formatting Web page content launched by the website.

2,CSS as each website designer must master one of the technologies, there are several advantages :

(1) Improve page browsing speed, save at least 50% more file size than traditional text design method

(2) Shorten the revision time, reduce maintenance costs

(3) Combine CSS and div for better control of page layout

(4) Separation of performance, structure and content

(5) More convenient search engines

3. CSS style sheet

(1) embedded style sheet

Style settings that include styles within a Web page with the <style> element,<style> segment must appear in the

Such as:

<! DOCTYPE html>
(2)external style sheet

Created externally . CSS files, write CSS code, and then in . Used by links in HTML files.

Syntax: <link rel= "stylesheet" type= "text/css" href= "url in style sheet"/>

(3) inline style sheet

Only for part of a page element, scoped to the page element to which it is applied, inline style in HTML markup

such as: <div style= "color:red; Font-weight:bold; " > Inline Styles </div>

4. Style rules

(1) Selector Selector : Specifies which element or elements of a style rule can be used in an HTML document, and the selector is left on the left curly brace in the style rule.

such as: h1{Color:orange; Background-color: #eea; } in the H1

(2) declaration block : The section between curly braces

such as: h1{Color:orange; Background-color: #eea;}  In the color:orange; Background-color: #eea; Part

(3) Statement : Each declaration is separated by a semicolon (; ) ends.

such as: h1{color:red;} in the color:red; Part is a statement

Within a declaration block, you can have multiple declarations, each of which must be separated by semicolons

(4) Properties

such as: h1{color:red; the color in the} is an attribute, and each declaration can have only one property.

(5) Notes

CSS comments are:/* Comment content */

Shortcut keys are: Ctrl + "/"


CSS Basics 1--CSS style sheets and style rules

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.