html - 使用 :after 选择性进行内联样式设置
问题描述
我有下面这样的样式表,
h3 {
position: relative;
background: #dfefff;
box-shadow: 0px 0px 0px 5px #dfefff;
border: dashed 2px white;
padding: 0.2em 0.5em;
color: #454545;
}
h3:after {
position: absolute;
content: '';
left: -7px;
top: -7px;
border-width: 0 0 15px 15px;
border-style: solid;
border-color: #fff #fff #a8d4ff;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.15);
}
<h3>Title</h3>
但是在我的网络规则中,我不能使用标签
所以我必须使用 like
<h3 style ="position: relative;background: #dfefff;~~">
我怎样才能使用h3:after
这种风格?
解决方案
您不能添加pseudo
operator inline Style
,因为Pseudo
operator 只能在 CSS 中使用classes
,并且Ids
并且您正在考虑添加pseudo
具有style
属性的运算符,这是不可能的,
有关更多信息,请访问本文。这将对您有所帮助
https://www.w3.org/TR/css-style-attr/
推荐阅读
- python - 如何在 python 字典中获取用户输入并打印出来?顺便说一句,我是新手
- javascript - element.style.width 和 element.style.height 不起作用
- python - 如何获取在python中不断变化的元素的文本
- spring-kafka - 带有 FixedBackOff 忽略间隔的 SeekToCurrentErrorHandler - spring kafka 2.7.0
- java - 即使启用了访问,AWS Access Prod 也会出错
- movilizer - 在 Movilizer 中得到不一致的结果
- qt - 如何从 qml 代码中找出屏幕编号?
- java - Micronaut 无法加载和使用我的“TypeConverter”实现
- python - 合并 2 个 pandas 字典列
- c++ - VSCode (C++) - 查看包含的符号