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 use the content of HTML

2025-02-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge points of this article "how to use content of HTML", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use content of HTML" article.

It is important to note that you must have the attribute of content, even if there is only content: ";, because pseudo elements without content will not appear on the screen. However, content is a very special attribute. It can use attr to directly obtain the attribute value (attribute) of content elements. For example, if there is a hyperlink in HTML, a new window will pop up and link to Google:

Google

Using the following code usage, the hyperlinked href content and target content will be displayed through pseudo elements before and after.

A::before {content: attr (href); color:red;} a::after {content: attr (target); color:green;}

In addition, content content can be "added", but unlike JavaScript, which is connected with a + sign, it can be continuously added with a blank key. In the following code, punctuation marks can be added after the hyperlink text just retrieved and in front of the target attribute.

A::before {content: "(" attr (href) ")

< "; color:red;}a::after{ content: " >

("attr (target)") "; color:green;}

Content can even use the ability to put pictures in url, and the following code will render three images.

Div::before {content:url (picture URL);}

The above is about the content of this article on "how to use the content of HTML". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow 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