1
I have a big problem to solve here and even though I think there is no solution I want help, I will not be seeing the problem as a whole...
I have the following code on a page:
.elemento {
width: 400px;
padding: 20px
}
<div class="elemento">
<p>Tudo aqui dentro de .elemento, incluindo este parágrafo é importante ser exibido, exceto o link abaixo:</p>
<a href="#" target="_blank" style="animation: none!important;background: rgba(255,255,255,.5);url('...')no-repeat 8px center !important;border: none!important;border-radius: 6px!important;bottom: auto!important;box-sizing: border-box!important;color: rgba(0,0,0,.5)!important;display: inline-block!important;float: none!important;font-family: Roboto,Arial,Sans-serif!important;font-size: 12px!important;font-weight: 700!important;height: 28px!important;left: 50%!important;line-height: 16px!important;margin: 8px auto!important;opacity: 1!important;padding: 6px 6px 6px 32px!important;position: relative!important;right: auto!important;text-align: left!important;text-decoration: none!important;text-indent: 0!important;top: auto!important;transform: translateX(-50%)!important;visibility: visible!important;max-width: 240px!important;z-index: 99999!important;zoom: 1!important;background-color: rgba(238,238,238,0.9)!important;">Problema</a>
</div>
I need to hide the tag <a></a>
using only CSS, the problem is that the entire inline CSS of this link is with !important
and I cannot hide/remove its parent element, as the siblings need to be exhibited. The pseudo-elements ::before
and ::after
are not defined.
Is there any way to hide without using JS?
Dude I don’t get it right, you want to give a display:One no <a> inside the div.elemento? It’s not clear what you want
– hugocsl
With JS just delete the style and put what you want. Example:
document.querySelector('.elemento > a').style = "display: none !important;"
– fernandosavio
Without JS you will see that the
style
with!important
takes precedence over CSS... So the answer is that there is no way to do this without gambiarra. Not to mention that bystyle
of the element, it is clear that whoever created the element did not want it to be erased.– fernandosavio
@hugocsl that’s right, I want to make the element invisible.
– Leonardo Dias
@fernandosavio so. Really this is the intention of those who created the element... Wanted to find a means/gambiarra to be able to hide. It can even be with gambiarra, no problem. The problem is in using JS.
– Leonardo Dias
So the secret is to list all the CSS properties the element uses and figure out a way to hide the element using any property that is not in
style
.– fernandosavio
@fernandosavio I took a look and it looks q, unfortunately it was used all possible properties
– Leonardo Dias
Yeah, it’s bad news... now you can only hope someone finds a loophole in it.
– fernandosavio
It’s really hard, I only see one way to solve this.... to solve a gambiarra normally you need another gambiarra :/
– hugocsl
@fernandosavio Two solutions =) the guy who did forgot the
filter: opacity()
haha– hugocsl