在CSS内容属性中添加HTML标记 [英] Add HTML tag inside CSS Content property

查看:182
本文介绍了在CSS内容属性中添加HTML标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找在内为CSS内容属性添加HTML标记的方法:之后和:之前



此问题不同的是,它只讨论添加符号< 。我想添加的是:

  .breadcrumbs li a:before {
content:'< ; i class =icon>< / i>';
}

有没有可能的方法?

解决方案

这是不可能的。您不能从CSS生成标记。



它也应该是不必要的 - 在您已经生成的伪元素中粘贴您的背景图片/图标字体/ >

I'm looking for a way to add an HTML tag for CSS content property inside :after and :before.

Unlike this question which only discusses adding symbols like <. What I'm trying to add is something like:

.breadcrumbs li a:before {
    content: '<i class="icon"></i>';
}

Is there any possible way to do that?

解决方案

This is impossible. You cannot generate markup from CSS.

It should also be unnecessary - stick your background image / icon font / whatever in the generated pseudo-element you have already.

这篇关于在CSS内容属性中添加HTML标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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