Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to introduce CSS into HTML

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how HTML introduces CSS", the content is simple and easy to understand, the organization is clear, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how HTML introduces CSS" this article.

I. Embedded

The first approach, embedded, refers to using HTML elements, adding them inside, and then defining the CSS style content specified inside.

Top Code:

button - (yisu.com) h2{ color:red; } p{ color:blue; } II. Inline style

Inline style is more straightforward, it is to add style attributes to each HTML element, you can directly define the element style. The style is valid only for its element and has no effect on another element of the same name or type

Top Code:

w3cschool

III. External reference

External references refer to CSS styles that are not embedded or inline in HTML, but dynamically reference external CSS files to decorate HTML.

1. Style sheet processing instruction statement

Add style sheet directives at the beginning of HTML documents

Top Code:

directive statement

This situation is due to the use of xml syntax to write html documents supported by the directive, most browsers have to save the city xhtml or xml format to take effect, and JS can not handle such CSS, not recommended.

2.@import command

Import external CSS files using the @import command in

Top Code:

button - (yisu.com) 3. Use link element (most commonly used)

Top Code:

4. HTTP Message

Use the link field in the HTTP message header to link it to an external style sheet

Top Code:

link:;rel=stylesheet; above is "how to introduce CSS HTML" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report