Home >Web Front-end >CSS Tutorial >How to write css inline style

How to write css inline style

藏色散人
藏色散人Original
2019-05-31 14:06:5621187browse

There are several ways to use CSS styles in pages: inline style, inline style, link style and import style.

How to write css inline style

Inline style

Inline style is to add CSS code directly to the HTML markup, that is, as the attribute tag of the HTML markup exist. In this way, you can easily define styles for an element individually.

Create a new file 02-06.html, enter the following code, create three paragraphs p, and define an attribute style, which is used to define the display style of the paragraph, such as font color and font size.

How to write css inline style

(2) Press the [F12] key to run, the result is as shown below:

How to write css inline style

See from the example Inline styles are defined using the style attribute, which can be anywhere in a p tag. At the same time, it can be found that if all labels in a large application use inline styles, the later maintenance investment will be very large. In this regard, the use of inline styles should be avoided as much as possible.

The above is the detailed content of How to write css inline style. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn