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/