HTML inline is to use the style attribute in a specific HTML tag to set the css style, and write the css style code in an html tag element in the specific web page; the syntax "
".
The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.
HTML inline is to use the style attribute in a specific HTML tag to set the css style, and write the css style code in an html tag element in the specific web page
Syntax:
<标记 style="样式的属性名1:样式的属性值1;属性名2:属性值2;......"></标记>
Example:
<div style="color:#f00"></div>
Features:
1), inline styles are placed in HTML elements in the code.
2) When using inline styles, the styles will only affect the elements you select.
3), Inline styles have no selectors
Note: Inline styles defined in HTML only apply to the tags they are added to.
It is recommended not to use inline styles because each HTML tag needs to be styled separately. If you only use inline styles, it may become very difficult to manage the website. However, it can be useful in certain situations. For example, in situations where you don't have access to CSS files or only need to apply styles to a single element.
An example of an HTML page with inline CSS is as follows:
<!DOCTYPE html> <html> <body style="background-color:black;"> <h1 style="color:white;padding:30px;">Hostinger Tutorials</h1> <p style="color:white;">Something usefull here.</p> </body> </html>
Advantages of inline:
1. If you want to test and preview changes, is very useful.
2. Very useful for quick repair.
3. Reduce HTTP requests.
Disadvantages of inline:
Inline CSS must be applied to every element.
Recommended tutorial: "html video tutorial"
The above is the detailed content of What does HTML inline mean?. For more information, please follow other related articles on the PHP Chinese website!