CSS (cascading style Sheets) cascading style sheets
meaning
a computer language;
can achieve the separation of web pages and content;
Used to represent file styles, such as HTML or XML;
Compare
Div and css
If Div is a container, then CSS is the thing that decorates or displays the style of the container. such as Div is a box, then the role of CSS is to indicate the color of the box, size, volume and so on.
HTML and CSS
HTML is responsible for the content of the Web page, CSS is responsible for Web page style, and CSS is good to decouple the content and style of the page.
Selector Selector
After setting the selector, we can set the CSS style.
That's not a selector, okay? By analogy in Word, we can set the text of each paragraph or line in the article to a unique style, which can include font-size (font size), width,height, and so on.
Selectors in CSS can be divided into ID selectors, class selectors, and HTML selectors.
1), ID selector
You can create a specific style for an HTML element labeled with a specific ID, defined by "#".
#newnews {/ * Latest News Frame */ font-size:20px; margin-left:5px; margin-bottom:10px;}
2), class selector
A style used to describe a set of elements that can be used in multiple elements, at a point "." The number is displayed.
. replay { margin-bottom:30px;/* bottom margin */}
3), HTML tag Selector
No identification, direct reference
How to uselooking at the previous two examples, some people are sure to wonder: we set the style for Newnews,replay, how do they use it on the web?
Next, let's talk about how to define a Web page .
1), external: Link a Web page to an external style sheet.
2), Inside page: Create an embedded style sheet on a Web page.
3), in line: an inline style to each page element.
The first kind of:--> write in a CSS file
You can use an external style when you are using the same style on other pages, or in order to maintain a consistent overall appearance of the Web page. External style changes are also very handy.
<link href= ". /css/login.css "rel=" stylesheet " type=" Text/css "/> <!--external style sheet is login.css-->
The second type:-
write on head
When we define the style of the current page, we can use an embedded style sheet. It is "embedded" within the <HEAD> tag of the Web page.
The third type: - in HTML
When special styles need to be applied to individual elements. the way to use inline styles is to use style attributes in related tags.
<p style= "Color:black; margin-left:20px "> here is the text! </p>
CSS seems to be a new thing, but as long as the hands to practice, you will find that it is a lot of knowledge is before the contact. For example, set the font, line spacing, and so on, to try a lot.
After introducing the concept of CSS and several usage methods, the following blog is about the core content of CSS.