Inline style is to write css style code in an html tag element in a specific web page; inline style should be used within a specific HTML tag, and use the style attribute to set specific HTML The style of the markup. For example: <div style="color:#f00"></div>
Features:
1), inline Styles are placed in HTML elements within 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 styles:
1. If you Useful if you want to test and preview changes.
2. Very useful for quick repair.
3. Reduce HTTP requests.
Disadvantages of inline styles:
Inline CSS must be applied to every element.
The above is the detailed content of What is inline css?. For more information, please follow other related articles on the PHP Chinese website!