css: how to remove pseudo elements (after, before, ...)
I would like to use a switch for the layout of paragraph tags on a webpage.
I use the after pseudoelement
p:after {content: url("../img/paragraph.gif");}
Now i need to remove this css code from the page. How can this be done easily (jquery is already used on the page)? (i do not want to include or remove files containing css)
p:after {
content: none;
}
none is the official value to set the content, if specified, to nothing.
http://www.w3schools.com/cssref/pr_gen_content.asp
You need to add a css rule that removes the after content (through a class)..
An update due to some valid comments.
The more correct way to completely remove/disable the :after
rule is to use
p.no-after:after{content:none;}
as Gillian Lo Wong answered.
Original answer
You need to add a css rule that removes the after content (through a class)..
p.no-after:after{content:"";}
and add that class to your p
when you want to with this line
$('p').addClass('no-after'); // replace the p selector with what you need...
a working example at : http://www.jsfiddle.net/G2czw/
$('p:after').css('display','none');
链接地址: http://www.djcxy.com/p/88860.html
上一篇: 是否:在不使用img元素之前?