How do I remove the <input type="reset"> border without removing my css border?

Asked

Viewed 127 times

-1

#botoes {
  width: 270px;
  margin-left: 20px;
}

#botao {
  float: right;
  padding: 5px;
  15px;
  font: bold 12px sans-serif;
  border-radius: 20px;
  box-shadow: 0px 1px 0px white;
  border: 1px solid #9eb9c3;
  background: #edf6f9;
  background: -webkit-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: -moz-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: -o-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: linear-gradient(#edf6f9 0%, #cde5ee 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf6f9', endColorstr='#cde5ee', GradientType=0);
  color: #527988;
  box-shadow: 0px 0px 10pc #c9c9c9
}

#botao:hover {
  background: #cde5ee;
  background: -moz-linear-gradient(top, #cde5ee 0%, #edf6f9 100%);
  background: -webkit-linear-gradient(top, #cde5ee 0%, #edf6f9 100%);
  background: linear-gradient(to bottom, #cde5ee 0%, #edf6f9 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cde5ee', endColorstr='#edf6f9', GradientType=0);
  cursor: pointer;
}
<div id=botoes>

  <div id="botao">
    <input type="submit" name="enviar" value="Enviar">
  </div>

  <div id="botao">
    <input type="reset" name="limpar" value="Reset">
  </div>

  <div id="lembrar-senha">
    <input type="checkbox" />Lembrar senha
  </div>

2 answers

1

Just in the first line of your CSS you put it like this

[type="reset"] {
  all: unset;
}

To the IE You can do it that way since he doesn’t accept the unset (source)

[type="reset"] {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

The important thing is that these styles come right at the beginning of your CSS, before the custom styles you’ve put.

That way you reset all default values of this type of input, then you put the styles you want. OBS: Notice that I have not cleaned the styles of btn type="submit" for you to see the difference between one and the other.

See Example applied with your code.

/* reseta estilos desse input */
[type="reset"] {
  all: unset;
}
  
  #botoes{
width:270px;
margin-left:20px;

}
#botao{
float:right;
padding:5px 15px;
font: bold 12px sans-serif;
border-radius:20px;
box-shadow:0px 1px 0px white;
border:1px solid #9eb9c3;

background: #edf6f9;
background: -webkit-linear-gradient(#edf6f9 0%, #cde5ee 100%);
background: -moz-linear-gradient(#edf6f9 0%, #cde5ee 100%);
background: -o-linear-gradient(#edf6f9 0%, #cde5ee 100%);
background: linear-gradient(#edf6f9 0%, #cde5ee 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf6f9', endColorstr='#cde5ee',GradientType=0 );
color:#527988;
box-shadow:0px 0px 10pc #c9c9c9
}

#botao:hover{
background: #cde5ee;
background: -moz-linear-gradient(top, #cde5ee 0%, #edf6f9 100%);
background: -webkit-linear-gradient(top, #cde5ee 0%,#edf6f9 100%);
background: linear-gradient(to bottom, #cde5ee 0%,#edf6f9 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cde5ee', endColorstr='#edf6f9',GradientType=0 );
cursor:pointer;
}
<div id=botoes>
      
  <div id="botao">      
        <input type="submit" name="enviar" value="Enviar">
    </div>
  
  <div id="botao">
        <input type="reset" name="limpar" value="Reset">
  </div>

    <div id="lembrar-senha">
      <input type="checkbox"/>Lembrar senha
    </div>

</div> 

There are other ways to fix this, but this I find the most practical, because it cleans the styles of user-agent and vc can get "from scratch" the styles of your element.

1

The ideal would be to style the element itself instead of creating a wrapper to the reset, This only tends to complicate more how you’re applying styling to the elements. At first, if it is only the border mentioned in the question, simply remove the edge (from the child element) and inherit the property values background and cursor of the parent element:

input[type='reset']{
  border: none;
  background: inherit;
  cursor: inherit
}

You can read more about inherit in that reply.

#botoes {
  width: 270px;
  margin-left: 20px;
}

#botao {
  float: right;
  padding: 5px;
  15px;
  font: bold 12px sans-serif;
  border-radius: 20px;
  box-shadow: 0px 1px 0px white;
  border: 1px solid #9eb9c3;
  background: #edf6f9;
  background: -webkit-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: -moz-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: -o-linear-gradient(#edf6f9 0%, #cde5ee 100%);
  background: linear-gradient(#edf6f9 0%, #cde5ee 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf6f9', endColorstr='#cde5ee', GradientType=0);
  color: #527988;
  box-shadow: 0px 0px 10pc #c9c9c9
}

#botao:hover {
  background: #cde5ee;
  background: -moz-linear-gradient(top, #cde5ee 0%, #edf6f9 100%);
  background: -webkit-linear-gradient(top, #cde5ee 0%, #edf6f9 100%);
  background: linear-gradient(to bottom, #cde5ee 0%, #edf6f9 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cde5ee', endColorstr='#edf6f9', GradientType=0);
  cursor: pointer;
}

input[type='reset']{
  border: none;
  background: inherit;
  cursor: inherit
}
<div id=botoes>

  <div id="botao">
    <input type="submit" name="enviar" value="Enviar">
  </div>

  <div id="botao">
    <input type="reset" name="limpar" value="Reset">
  </div>

  <div id="lembrar-senha">
    <input type="checkbox" />Lembrar senha
  </div>

  • Young man... just a little something for you to test there. Try putting a 50px padding on that div, or change the color of the gradient from red to blue. You will see that the gradient erdado by the input is buggered, because it is not the same height of the father. The ideal would even be to remove the wrapped div of the input and stylize the input, with the inherit the child gradient does not "marry" with the father’s

  • That’s the scenario AP put in his question?

  • 1

    I just made a comment for you test there young, a test in what I said, as the color of his gradient is soft is difficult to notice, but if the gradient is more accentuated between the first and the second color you will see that it does not look cool. Do the test there quick use this gradient linear-gradient(to bottom, red 0%, blue 100%) you will see that inheriting the gradient does not align the colors. The padding suggested just to make it easier for you to see. But you can only test with another color. Nice was just a comment for you to test and evaluate.

  • 1

    I also said good. =)

  • 1

    Cool that you took it easy, is why here are people who have ego in the heights and does not accept neither comment, or even to think 2x before coming out negative. I only gave the tip pq when I opened on my monitor even though the color was soft I saw that gave a break in the gradient, then I suggested you to do the test. If someone else applies the example with other colors it may result in an unwanted effect. Tmj

Browser other questions tagged

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