I am interested in seeing if I can use the :before
pseudo-element on a <a href
wrapped around a <button>
element?使用:在僞元素之前'<a href' that is wrapping a <button> element - can it be done?
Currently, Firefox shows a thin blue line behind the <button>
element - this is due to it being wrapped in an <a href
.
If I use an inline style within the <a href
the line goes away:
<a href="#" style="text-decoration:none;"><button>
However, since I have <button>
elements on multiple pages, I want to target them using CSS if possible (and I don't particularly want to go and add a class to all the <a href
that are wrapping the <button>
's on the site). This is where I was thinking the :before
pseudo-element would come in handy but it doesn't seem to work:
a:before button{
text-decoration:none !important;
}
This is how the <button>
's display in Firefox, see the blue default text-decoration applied to the <a href
. The reason it is showing up only on the right hand side is because a class of margin-left:5px
is applied to the <button>
element:
Here's a basic version of the buttons up on jsfiddle (ignore slight appearance differences): http://jsfiddle.net/Vtjue/2/
任何想法?
」Firefox在
對不起,它將默認的藍色下劃線應用於在