Define the css style in the front-end code file

In a front-end code file, there are two types of css styles that are directly applied to the current file, one is an internal style sheet, and the other is an inline style;

The following code;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div {
            background-color: red;
            width: 200px;
            height: 200px;
        }
    </style>
</head>

<body>

</br>
</br>
</br>

<div>
 AAAAAAAA
</div>

</br>
</br>
</br>

<p style="color:sienna;margin-left:20px">这是一个段落。</p>
</body>
</html>

Run as follows;

The internal style sheet is defined between <style> and </style>;

Inline styles are defined directly on web page elements using style="xxx"; such as the above <p style="color:sienna ......;

Guess you like

Origin blog.csdn.net/bcbobo21cn/article/details/132125452