简体   繁体   中英

Round the corners of outline property CSS

I have this element with this style added:

.checkout-step.current .number {
  background-color: #d26d51;
  outline: 1px solid #d26d51;
  outline-offset: 4px;
}

在此处输入图片说明

But I not want square corners in the outline, I want round the corners, like this example: 在此处输入图片说明

How can I do this?

My approach is as follows. Please check JSFiddle . I have added following HTML.

<a href="#">2</a>

I have added following css.

a {
  background: #999;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  text-decoration: none;
  color: #fff;
  display: inline-block;
  line-height: 40px;
  position: relative;
  border: 2px solid #000;
  text-align: center;
}
a:after {
  content: '';
  display: block;
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: -10px;
  right: -10px;
  border-radius: 30px;
  border: 2px solid #f00;
}

Use border-radius property to do this. http://www.w3schools.com/cssref/css3_pr_border-radius.asp

**use this code **
outline we cant use radius property Instead of outline make as border and radius so i changed code like this Try This .

Html

<div class="usecode"><div class=".checkout-step.current .number">2</div></div>

css

    .checkout-step.current .number {
      background-color: #d26d51;
     margin:15px;

      }

.usecode
 {
 border:1px solid #d26d51;
border-radius:25px !important;
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM