css {content:" text"},如何添加标签? [英] css { content: "text"}, How do i add tags?

查看:146
本文介绍了css {content:" text"},如何添加标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些虚拟CSS。代替标签我有转义字符。

I wrote some dummy css. Instead of a tag I got escaped characters. How can I add a div tag instead?

.HeaderName:after{
content: "<div class=\"Name2\">text</div>";
}

.Name2 {
color: red;
}


推荐答案

content 声明不能向页面添加标签(标签是结构化的);此外,CSS用于演示更改,而不是结构内容更改。

The content declaration cannot add tags to the page (tags are structural); additionally, CSS is meant for presentation changes, not structural content changes.

请考虑使用jQuery,例如:

Consider using jQuery, instead, such as:

$(".HeaderName").after("your html here");

这篇关于css {content:&quot; text&quot;},如何添加标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆