What is inline css?

青灯夜游
Release: 2019-05-31 13:08:39
Original
8696 people have browsed it

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: <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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!