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 five CSS styles into XHTML

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces how to introduce five major CSS styles in XHTML, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Do you know what ways XHTML can introduce CSS style? Here to share with you, XHTML mainly introduces five major CSS styles, they are STYLE attribute, LINK tag, tag, STYLE tag and @ import introduction.

What are the ways for XHTML to introduce CSS style

XHTML files are controlled by CSS style display, that is, the combination of XHTML and CSS to represent the content of the page. So what are the ways to introduce CSS styles into XHTML files?

Use the STYLE attribute

Add the STYLE attribute directly to the individual component tag.

The advantage of this method is that the style can be applied to each label cleverly. Easy to use when writing code.

The disadvantage of this method: there is no "unity" of the whole document, and it becomes more difficult when you need to modify a certain style.

Second, use STYLE tags

Write the CSS style rules in... In the label.

ExampleSourceCode

For example:

ExampleSourceCode

Usually the whole. The structure is written in the part of the web page.

The advantage of this approach: the entire article has a unity, as long as there is a declared component will apply the style rules.

The disadvantage of this method is that the flexibility of individual components is insufficient and the functionality of the whole station is weak.

Third, use LINK tags

Write CSS style rules in a style file in .css and introduce them as tags.

Suppose we save the style rules as an example.css file, we just need to add:

ExampleSourceCode

After the introduction of the css stylesheet file, you can directly apply the styles developed in the style file. Link tags are usually written in the section of a web page.

The advantage of this method: several files that want to apply the same style rules can be assigned to the same style file, which can be modified uniformly, and it is convenient for the setting of the whole station to have a unified style. This method is generally used in css page layout.

The disadvantage of this approach is the lack of flexibility in individual files or elements.

Use @ import to introduce

It is very similar to the link method, but it must be placed in. Medium:

ExampleSourceCode

For example:

ExampleSourceCode

What should be noted is that the semicolon at the end of the line is a must! You mustn't miss it!

The advantage of this method: the css file can be flexibly introduced to control the xhtml elements. Sometimes it is also used to write some csshack.

The disadvantage of this approach is the lack of flexibility in individual files or elements.

Introduction of CSS style using markup

For example:

ExampleSourceCode

Template worry-free

The advantage of this method is that the style can be applied to each label cleverly. Easy to use when writing code.

The disadvantage of this method: there is no "unity" of the whole document, and it becomes more difficult when you need to modify a certain style.

On how to introduce five major CSS styles in XHTML to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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