圆角轮廓 属性 CSS
Round the corners of outline property CSS
我添加了这个样式的元素:
.checkout-step.current .number {
background-color: #d26d51;
outline: 1px solid #d26d51;
outline-offset: 4px;
}
但是我不想要轮廓中的方角,我想要圆角,就像这个例子:
我该怎么做?
使用 border-radius 属性 来做到这一点。
http://www.w3schools.com/cssref/css3_pr_border-radius.asp
**使用此代码**
轮廓我们不能使用半径 属性 而不是轮廓作为边框和半径所以我改变了这样的代码试试这个。
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;
}
我的做法如下。请检查 JSFiddle。
我添加了以下 HTML.
<a href="#">2</a>
我添加了以下内容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;
}
我添加了这个样式的元素:
.checkout-step.current .number {
background-color: #d26d51;
outline: 1px solid #d26d51;
outline-offset: 4px;
}
但是我不想要轮廓中的方角,我想要圆角,就像这个例子:
我该怎么做?
使用 border-radius 属性 来做到这一点。 http://www.w3schools.com/cssref/css3_pr_border-radius.asp
**使用此代码**
轮廓我们不能使用半径 属性 而不是轮廓作为边框和半径所以我改变了这样的代码试试这个。
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;
}
我的做法如下。请检查 JSFiddle。 我添加了以下 HTML.
<a href="#">2</a>
我添加了以下内容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;
}