-4

I want to make outline around button. But as default instead of curved it is coming as a rectangle shape. Please guide me to make curved rounded outline using CSS.

Thanks

   <!DOCTYPE html>
   <html>
   <head>
   <style> 
   input {
       border: 2px solid #a1a1a1;
       padding: 10px 40px; 
       background: #dddddd;
       width: 300px;
       border-radius: 25px;
       outline : 2px solid red;
   }
   </style>
   </head>
   <body>

          <input type="button" value="Button" />

   </body>
   </html>
Velmurugan
  • 63
  • 1
  • 3
  • 9

4 Answers4

2

You can try giving box-shadow instead of outline. Like:

input {
  border: 2px solid #a1a1a1;
  padding: 10px 40px; 
  background: #dddddd;
  width: 300px;
  border-radius: 25px;
  box-shadow: 0 0 3px red;
}

Have a look at the snippet below:

input {
   border: 2px solid #a1a1a1;
   padding: 10px 40px; 
   background: #dddddd;
   width: 300px;
   border-radius: 25px;
   box-shadow: 0 0 5px red;
}
<html>
<body>
  <input type="button" value="Button" />
</body>
</html>

Hope this helps!

Saurav Rastogi
  • 9,575
  • 3
  • 29
  • 41
  • As per my Guideline instruction i should not use box-shadow. without box-shadow i should be do the outline. – Velmurugan Dec 27 '16 at 07:19
1

Natively this is not possible. Firefox has a property -moz-outline-radius but is not supported by all browsers.

You can check out this article for help with multiple borders, it has various techniques.

https://css-tricks.com/snippets/css/multiple-borders/

KAD
  • 10,972
  • 4
  • 31
  • 73
0

try this instead, create a class called outline-button

<!DOCTYPE html>
   <html>
   <head>
   <style> 
   .outline-button {
       border: 2px solid #a1a1a1;
       padding: 10px 40px; 
       background: #dddddd;
       width: 300px;
       border-radius: 25px;
   }
   </style>
   </head>
   <body>

          <input class ="outline-button" type="button" value="Button" />

   </body>
   </html>
alexdabest
  • 61
  • 1
  • 3
-1

border-radius will do the trick.

RE: It is because of the outline try to remove that line.

Papa Tom
  • 31
  • 5