CSS basic Syntax (i) 3 kinds of CSS Introduction

Source: Internet
Author: User

CSS style Sheets

CSS can be regarded as a breakthrough in web design, it solves the problem of Web interface layout. in other words, the tag of HTML mainly defines the content of the Web page, and CSS determines how the content of these pages is displayed (Layout).

In the early days of the web, HTML was a very limited language, a language that did not care about appearance, it was simply a small, compact markup mechanism.

With the advent of the Mosaic Web browser, the site began to emerge everywhere. The need to change the appearance of the page has increased, adding markup elements like <font> and <big>.

A few years later, most site tags consist almost entirely of tables and font elements, and do not convey any practical meaning to the content that is being performed, making the availability of the document less and easier to maintain.

So in 1995, the consortium issued a draft CSS to try to solve the problem of mixed structure and style.

In 1996, the CSS1 was officially launched.

1998, launched CSS2.

2001 starting from CSS3, the CSS language is divided into separate modules, each of which is individually graded and contains only a small subset of features.

Design CSS4 started in 2011

First, the introduction of CSS style sheet

1. Inline style sheet

The inline style sheet is written in the tag (tag). Inline styles are only valid for the tag in which they are located. (if there are multiple styles, the inline will overwrite the other style and take effect on your own)

Example:

<style= "font-size:20pt; color:red"></p>

This style definition <p></p> text inside is 20pt font, the font color is red.

2. Internal style sheet

The internal style sheet is written in the HTML

Internal style sheet to use the style of the tag, the following wording:

< style   type = "Text/css" >      Div{   : red;                    }</style>

3. External style sheet

if many web pages need to use the same style (styles), use an external style sheet. the external style sheet needs to be written in a CSS file and then introduced in the page with a <link> tag, which is introduced into each page where the style needs to be applied.

Example:

<HTML><HEAD>   <Linkhref=".. /css/a.css "rel= "stylesheet"type= "Text/css"></HEAD><BODY>...</BODY> </HTML>

1, <link> label location is generally written in the

2. CSS style file names are named with meaningful English letters, such as MAIN.CSS.

3, href= "" is the path of the introduction of CSS

4, rel= "stylesheet" type= "text/css" is fixed notation cannot be modified.

Remember their priorities: inline > Embedded > External

There is also a comment statement in the CSS: marked with the/* Comment statement */(Use <!--comment statement in HTML)

CSS basic Syntax (i) 3 kinds of CSS Introduction

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.