0

I have a button in my form, and would like to change its default border.

I can't remove the default and add mine, I have both or none

button.boton{
   cursor: pointer; 
   position: relative;
   background:red;
   border:none; /*delete the default one*/
   border: 1px solid blue; /*add my own border */
}

how can I do this?

4
  • It's working jsfiddle.net/cdm3Lwq2 Commented Mar 8, 2016 at 11:59
  • Are you wondering about the blue outline that occurs in Chrome when you click on the button? Commented Mar 8, 2016 at 12:01
  • oh yes, it didnt work because a filter I add in my original css Commented Mar 8, 2016 at 12:04
  • check my answer below , and here is a jsfiddle link Commented Mar 8, 2016 at 12:36

3 Answers 3

2

Use class identifier to let the style be applied on your button:

CSS Code:

button.boton{
   cursor: pointer; 
   position: relative;
   border: 1px solid blue; /*add my own border */
}

HTML Code:

<button class="boton"> Button </button>

Also try this jsfiddle link

EDIT:

Here is a screenshot of the output file in internet explorer version 11

enter image description here

For IE9 :

If you specify 3 of the borders, those borders will render in IE9. Once you specify the 4th border, IE9 refuses to render any of the borders

button.boton{
       cursor: pointer; 
       position: relative;
       border-top: 1px solid blue;
       border-right: 1px solid blue;
       border-bottom: 1px solid blue;
    }
Sign up to request clarification or add additional context in comments.

4 Comments

it works in chrome but it doesnt in internet explorer
in internet explorer 11.0 it is working, you can see my updated answer, also try to upgrade your internet explorer
add a background it will stop working. I need it working since IE 9
for IE9,you should specify only 3 of the borders, those borders will render in IE9, check now the answer.
1

Try adding this to the CSS:

-webkit-appearance:none;

And make sure nothing else is adding a border around your button.

Comments

0

You do not need to set the border twice. When you set the border it will remove all properties that were previously set.

1 Comment

I know that, but it's not working in internet explorer and it was just a try!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.