我有div,包含一些html格式的文本,如normal, <b>bold</b>, <i>italic</i>
。
我需要更改该div中所有粗体文本的字体大小。
所以问题是如何在html / css或js中执行此操作?
答案 0 :(得分:8)
div.foo b, div.foo strong {
font-size: 1.2em
}
如果你使用像<i style="font-weight:bold">
这样的内联样式,则更复杂。
然后你必须使用jQuery + CSS
$('div.foo *[style=font-weight:bold]').addClass('myFontSize');
div.foo .myFontSize {
font-size: 1.2em;
}
但请注意,这不是好习惯。
答案 1 :(得分:2)
div#divid b { font-size: 18px; }
答案 2 :(得分:1)
您可以将元素选择器用作:
#divId b
{
font-size:1.1em;
//what ever you want also
}