CSS: How to remove pseudo elements (after, before,...)?
Solution 1:
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
Solution 2:
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/
Solution 3:
$('p:after').css('display','none');
Solution 4:
As mentioned in Gillian's answer, assigning none
to content
solves the problem:
p::after {
content: none;
}
Note that in CSS3, W3C recommended to use two colons (::
) for pseudo-elements like ::before
or ::after
.
From the MDN web doc on Pseudo-elements:
Note: As a rule, double colons (
::
) should be used instead of a single colon (:
). This distinguishes pseudo-classes from pseudo-elements. However, since this distinction was not present in older versions of the W3C spec, most browsers support both syntaxes for the sake of compatibility. Note that::selection
must always start with double colons (::
).