CSS is an indispensable part of the web design process. By adding styles, you can achieve web beautification, layout, interactive behavior and other effects. The css language is flexible and changeable, and different visual effects can be achieved through different attributes and their corresponding values. So, how many styles does CSS have? This article will take an in-depth look at the different styles of CSS.
1. Inline style
Inline style is a way to define the style directly in the HTML tag. Add the "style" attribute to the tag, and then add the CSS style attributes and their corresponding values to the attribute to set the style. For example:
<h1 style="color: red;">这是一段红色文字</h1>
The advantage of inline styles is that they are simple and easy to implement, and you can quickly set styles on individual elements. However, if multiple elements need to be styled identically, inline styles are cumbersome and difficult to maintain because the entire style can only be modified within the HTML document.
2. Embedded styles
Embedded styles use the