所以,我试图将这个按钮放在DIV中。
该按钮是一个href链接......
这是一个例子......
我一直认为我可以将边距设置为0并且它可以工作,但我猜不是。
以前工作过吗?我不确定我做错了什么
<div style="background-color:#0F0; width:100%; height:100px; display:block;">
<div style=" width:50%; margin:0 auto;"><a style="margin:0px;"class="btn btn-3 btn-3d icon-cog">Settings</a></div>
</div>
答案 0 :(得分:0)
你必须将显示设置为阻止它工作
#button {
display: block;
margin: 0 auto;
}
答案 1 :(得分:0)
尝试:
<div class="center"><a class="btn btn-3 btn-3d icon-cog">Settings</a></div>
.center{text-align:center;}
答案 2 :(得分:0)
<强> HTML 强>
<div style="background-color:#0F0; width:100%; height:100px;">
<div style=" width:50%; margin:0 auto;"><a class="btn btn-3 btn-3d icon-cog">Settings</a></div>
</div>
<强> CSS 强>
/* General button style (reset) */
.btn {
border: none;
font-family: inherit;
font-size: inherit;
color: inherit;
background: none;
cursor: pointer;
display: inline-block;
text-transform: uppercase;
font-weight: 700;
outline: none;
position: relative;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
margin:0;
}
.btn:after {
content: '';
position: absolute;
z-index: -1;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
/* Pseudo elements for icons */
.btn:before,
.icon-heart:after,
.icon-star:after,
.icon-plus:after,
.icon-file:before {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
position: relative;
-webkit-font-smoothing: antialiased;
}
.icon-envelope:before {
content: "\e000";
}
.icon-cart:before {
content: "\e007";
}
.icon-cart-2:before {
content: "\e008";
}
.icon-heart:before {
content: "\e009";
}
/* Filled heart */
.icon-heart:after,
.icon-heart-2:before {
content: "\e00a";
}
.icon-star:before {
content: "\e00b";
}
/* Filled star */
.icon-star:after,
.icon-star-2:before {
content: "\e00c";
}
.icon-arrow-right:before {
content: "\e00d";
}
.icon-arrow-left:before {
content: "\e003";
}
.icon-truck:before {
content: "\e00e";
}
.icon-remove:before {
content: "\e00f";
}
.icon-cog:before {
content: "\e010";
}
.icon-plus:before,
.icon-plus:after {
content: "\e011";
}
.icon-minus:before {
content: "\e012";
}
.bh-icon-smiley:before {
content: "\e001";
}
.bh-icon-sad:before {
content: "\e002";
}
.icon-file:before {
content: "\e004";
}
.icon-remove-2:before {
content: "\e005";
}
/* Button 3 */
.btn-3 {
background: #fcad26;
color: #fff;
}
.btn-3:hover {
background: #f29e0d;
}
.btn-3:active {
background: #f58500;
top: 2px;
}
.btn-3:before {
position: absolute;
height: 100%;
left: 0;
top: 0;
line-height: 3;
font-size: 140%;
width: 60px;
}
/* Button 3d */
.btn-3d {
padding: 15px 60px 15px 70px;
}
.btn-3d:before {
background: #fff;
color: #fcad26;
z-index: 2;
line-height:51px;
}
.btn-3d:after {
width: 20px;
height: 20px;
background: #fff;
z-index: 1;
left: 55px;
top: 50%;
margin: -10px 0 0 -10px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.btn-3d:active:before {
color: #f58500;
}
.btn-3d:active {
top: 0;
}
.btn-3d:active:after {
left: 60px;
}
.icon-cog:before {
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
text-decoration: inherit;
-webkit-font-smoothing: antialiased;
content: "\f02d";
}
.center{text-align:center;}