HTML and CSS basic courses (vii) Css:an Overview

Source: Internet
Author: User
Tags html page

What CSS is (what is CSS)

CSS (cascading style sheets Cascading style sheet) is a language that describes the look and format of your HTML.

A stylesheet (style sheet) is a file that describes how an HTML page looks.

We say that these stylesheets are cascading (cascading) because these tables can be applied in more than one style. For example, you want all paragraphs <p> words to be blue, but only one of the words is red, and CSS can do that.

Just do this to set the CSS file:

p {  
    color:red;  
}  
      
span {  
    /*write your CSS here!*/  
    color:blue;  
}

After you connect the CSS file in the HTML file, you can automatically set the CSS style by using the <span> directly:

<! DOCTYPE html>  

Effect Chart:

Why sparate from function? (why should we separate the functions?) )

There are two main reasons to separate form/formating (CSS) and Content/strutrue (HTML):

1. You can customize the format for a label, and you will no longer need to rewrite the code to use the label later.

2. You can apply the same style sheet to multiple HTML files without rewriting the code

If it ' s in, it ' s out! (referencing CSS file)

In previous lessons, you learned about HTML inline styles (inline styling), such as:

<p style= "color:red" >red font!</p>

If you make a Web page this way, it will be scary: you have to write a lot of the same code, which makes the HTML file big! And if you want to change the style, then you need to change all the code! And if the use of CSS files, only need to modify this file can be, how easy!

There are two ways to set CSS for HTML files:

1. Built-in HTML, which is placed in the HTML file

For example:

<span style= "font-size:14px" ><! DOCTYPE html>  

More Wonderful content: http://www.bianceng.cn/web/Html/

Related Article

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.