This time to bring you a variety of CSS writing style, CSS writing methods of attention to what, the following is the actual case, together to see.
Priority: External style < internal style sheet < inline style sheet;
Priority, that is: the right side of the selector with the same name overrides the left
1. Internal style sheet
CSS Code Copy content to clipboard
<style>
/* Internal style sheet, commonly used to override common styles */
#headtip {
Color:0xff5;
}
</style>
2. Use the link tag to declare one of the most common ways to use external resources in a document.
The CSS external style sheet specifies the encoded @charset= "Utf-8"; Need to be placed on the first line.
xml/html Code Copy content to clipboard
<link href= "./my-common.css" rel= "stylesheet" media= "screen" type= "Text/css"/>
3.@ the way, the introduction of CSS, note that this is asynchronous loading, after the entire HTML loaded before loading, will cause the page to blink. It is not recommended.
CSS Code Copy content to clipboard
<style>
@import ' My-common.css ';
</style>
4. Inline style sheet, the highest priority is the most straightforward, but not reusable is not easy to maintain.
xml/html Code Copy content to clipboard
<body>
<input type= "text" style= "color:0x550;font-size:30px;" />
</body>
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
The method of horizontal vertical centering of three absolutely positioned elements
Waterfall flow layout with unlimited load Picture album effect