How to hide button element using CSS only?

Asked

Viewed 922 times

1

I’m trying to use the property display: none in the element button, but it doesn’t work. If I put it in the class it works, e.g.:

.btn {
     display: none;
     }

But I put myself in the element button doesn’t work:

button {
     display: none;
     }

So the question is how do I hide the elements button without having to use class?

  • 2

    Of course it works... https://jsfiddle.net/Sergio_fiddle/be5mcp28/ you can create an example of your problem?

  • kkkk Oh, I must have done something wrong here! I’ll check, thanks Sergio!

  • Sergio, I was in conflict, so it didn’t work, with the !important suggested in the answer below worked...

1 answer

1


It’s likely that your css is in conflict with some other, in this case you can increase the weight of css. For example:

div #btnEnviar.btn {
     display: none !important;
}
  • Ah, that’s right, I don’t know if because I’m wearing the bootstrap, or if it might have something to do with the js, but with the !important worked... thanks, soon I confirm the answer (when pass the minimum time)...

  • 1

    @gustavox is Bootstrap yes ! kkk had this problem numerous times.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.