开发者

Is it possible to make a css declaration override a style set in the element's style property?

开发者 https://www.devze.com 2023-01-28 01:17 出处:网络
Is it possible to make a css declaration override a style set in the element\'s style property? eg: 开发者_运维百科<div class=\"root\"><p style=\"font-size:13px;\">hello</p></di

Is it possible to make a css declaration override a style set in the element's style property?

eg:

开发者_运维百科
<div class="root"><p style="font-size:13px;">hello</p></div>

Is there someway I can override the font size with css?

I already tried .root p{font-size:16px !important;}

The reason I want to do this is that I am making a javascript rich text editor, and sometimes when someone pastes into the editor, it adds styles like that. But I don't want it to appear as smaller text.


The following code looks wrong , remove the class=root on closing div.

<div class="root"><p style="font-size:13px;">hello</p></div class="root">

with jquery you can do it as below

fontsize can be a variable which you set dynamically

('selector').css('font-size',fontsize);
0

精彩评论

暂无评论...
验证码 换一张
取 消