"/> ">

Home  >  Article  >  Web Front-end  >  What is inline css?

What is inline css?

青灯夜游
青灯夜游Original
2019-05-31 13:08:398654browse

What is inline css?

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: 69488b5ef9e0d45b3c24d1c2c63b861416b28748ea4df4d9c2150843fecfba68

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!

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