Home >Web Front-end >CSS Tutorial >A brief introduction to the three methods introduced in css
This article introduces to you a brief introduction to the three methods introduced in CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
There are three ways to introduce CSS: internal style sheet, inline style (inline style) sheet, external style sheet, of course, you can also use multiple styles
<p style="color:red;font-size:20px">内联样式表</p >
Inline style unloads the style directly into the html code line. It is generally only used when this style is only applied to the current element. Others Try not to use it under certain circumstances.
<style> p { color: blue; font-size: 20px } </style>
The internal style sheet is generally written in the HTML header, using c9ccee2e6ea535a969eb3f532ad9fe89 within the 93f0f5c25f18dab9d176bd4f6de5d30e tag. tags enclosed. This method is generally used when the current page requires a special style.
<link rel="stylesheet" href="CSS/Googlefonts.css">
External style sheet writes the style to a css file separately and references it in the head. When using external style sheets, be aware of the problems caused by style overrides if multiple styles appear.
When using multiple styles, the multiple styles will overlap into one. Generally speaking, multiple style sheets will overlap into one according to the following rules, where 4 is the highest weight
Browser default settings
External style sheet
Internal style sheet (located in the head tag Internal)
Inline styles (inside HTML elements)
For the same element For multiple styles, the priority order is as follows, 7 has the highest priority (except for the !important rule, but generally try not to use it):
Universal selector (*)
Element (type) selector
Class selector
Attribute selector
Pseudo class
How to implement floating element line wrapping in css
Summary of usage of Grid layout in CSS (with code)
The above is the detailed content of A brief introduction to the three methods introduced in css. For more information, please follow other related articles on the PHP Chinese website!