Getting web front-end to combat: HTML CSS Wikipedia and common way of embedding

CSS (Cascading Style Sheet) can be translated as "Cascading Style Sheets" or "cascading style sheet" that defines how to display HTML elements, for controlling the appearance of a Web page. By using CSS to achieve separation of content and form of the page, which greatly improves the work efficiency. Styles are stored in a style sheet, it is usually placed in an external CSS file <head> section or storage. As the trend of standardized web design, CSS support on a wide range of browser vendors, it is increasingly being applied to web design to go.

The new web page is now standard W3C. The current model is html + css + javascript, how to understand it, is that html is the structure of the web, CSS is the style of the page, javascript behavior. Structure is to build a house to put structure built out, and then use CSS to decorate. In fact, when you do use dreamweaver website has used the CSS, for example, you use DW Properties panel to set the font, size and color of a word, when you selected, will automatically generate a .style1 of Code Red, the I do not know between the <style> </ style> you have not noticed, this is the CSS.

? How to use CSS CSS is used at the beginning of HTML 4, in order to better render HTML elements introduced .CSS can be added to HTML in the following ways:

  1. Inline style - using the "style" attribute in the HTML element
  2. Internal style sheet - HTML document head <head> region using <style> element to contain CSS
  3. External reference - Use external CSS file

What is inline styles ? When a particular style needs to be applied to the individual elements, you can use inline styles. The method of using the inline style is to use a style property associated Tags. Style attribute can contain any CSS property. The following example shows how to change the color of the paragraph and left margins.


1  <p style="color:#fff;margin-left:20px;background-color:yellow;">This is a paragraph.</p> 

NOTE: Early background color attribute (background-color) using bgcolor attribute definition.

What is the internal style sheet ? When a single file requires special style, you can use the internal style sheet. You can <head> section through <style> tag defines internal style sheet:

1 <head>
2  <style type="text/css"> 
3 body {background-color:yellow;}
4 p {color:blue;}
5  </style>
6  </head> 

专门建立的学习Q-q-u-n: 784783012 ,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习技巧
(从零基础开始到前端项目实战教程,学习工具,全栈开发学习路线以及规划)

What is an external style sheet ? When the style needs to be applied to many pages when an external style sheet would be the ideal choice. Use an external style sheet, you can change a file to change the appearance of the entire site.

1 <head>
2  <link rel="stylesheet" type="text/css" href="mystyle.css">
3  </head> 

Guess you like

Origin blog.51cto.com/14592820/2485817