--- title: ':active' slug: 'Web/CSS/:active' translation_of: 'Web/CSS/:active' ---
Esse estilo pode ser substituído por qualquer outra pseudo-classe relacionada ao link, ou seja, {{cssxref(":link")}}, {{cssxref(":hover")}} e {{cssxref(":visited")}}, aparecendo nas regras subseqüentes. Para estilizar apropriadamente os links, você precisa colocar a regra :active
depois de todas as outras regras relacionadas ao link, conforme definido pela ordem LVHA. :link
— :visited
— :hover
— :active
.
<body> <h1>:active CSS selector example</h1> <p>The following link will turn lime during the time you click it and release the click: <a href="#">Mozilla Developer Network</a>.</p> </body>
body { background-color: #ffffc9 }
a:link { color: blue } /* links não visitados */
a:visited { color: purple } /* links visitados */
a:hover { font-weight: bold } /* user hovers */
a:active { color: lime } /* links ativos */
Especificação | Status | Comentário |
---|---|---|
{{SpecName('CSS4 Selectors', '#active-pseudo', ':active')}} | {{Spec2('CSS4 Selectors')}} |
Nenhuma mudança.
|
{{SpecName('CSS3 Selectors', '#useraction-pseudos', ':active')}} | {{Spec2('CSS3 Selectors')}} |
Nenhuma mudança.
|
{{SpecName('CSS2.1', 'selector.html#dynamic-pseudo-classes', ':active')}} | {{Spec2('CSS2.1')}} |
Nenhuma mudança.
|
{{SpecName('CSS1', '#anchor-pseudo-classes', ':active')}} | {{Spec2('CSS1')}} |
Definição inicial.
|
Recurso | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Support on the <a> element |
1.0 | {{CompatGeckoDesktop("1.0")}} | 4.0 | 5.0 | 1.0 |
Support on any element | 1.0 | {{CompatGeckoDesktop("1.0")}} | 8.0 | 7.0 | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Support on the <a> element |
1.0 | {{CompatGeckoMobile("1.0")}} | 6.0 | 6.0 | 1.0 |
Support on any element | 1.0 | {{CompatGeckoMobile("1.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} [1] |
[1] By default, Safari Mobile does not use the {{cssxref(":active")}} state unless there is a touchstart
event handler on the relevant element or on the {{HTMLElement("body")}}.