[英]How to dynamically change font-size of :before element in pure CSS?
I want to change the size of the before pseudo-element dynamically, according to to font-size of the element, that the pseudo-element is set to. 我想根据伪元素设置为的元素的字体大小动态更改前伪元素的大小。
I use TinyMCE v4. 我使用TinyMCE v4。 I have added a style format as follows:
我添加了一种样式格式,如下所示:
style_formats: [
{
title: 'Custom Bullet',
selector: 'ul',
classes: 'custom_bullet'
},
]
I add following style with this format: 我以这种格式添加以下样式:
.custom_bullet li:before{
content: "\e013";
font-family: 'Glyphicons Halflings';
float: left;
color: #F00;
}
What I want to get, is that when I change font-size of li, the li custom marker should also change dynamically. 我想要得到的是,当我更改li的字体大小时,li自定义标记也应该动态更改。
I could do it with JS, but that's what i want to avoid. 我可以用JS做到这一点,但这就是我要避免的事情。 I would like to find a solution based on CSS.
我想找到一个基于CSS的解决方案。
I'm not sure if I understand you correctly, but what about: 我不确定我是否正确理解您的意思,但是:
.custom_bullet li, .custom_bullet li:before {
font-size: 1em;
}
Don't write the font-family in quotes 不要将字体系列用引号引起来
font-family: Glyphicons Halflings;
.custom_bullet li:before{
content: "\e013";
font-family: Glyphicons Halflings;
float: left;
color: #F00;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.