gpt4 book ai didi

html - 元素上边距似乎没有改变

转载 作者:太空宇宙 更新时间:2023-11-04 12:14:56 26 4
gpt4 key购买 nike

我有一些文字,下面有一个按钮。无论我将上边距更改为什么,按钮仍会粘在文本的底部。

我试图在文本和按钮之间留一个小间隙。

这是一个 Jsfiddle:http://jsfiddle.net/24bk2t78/

 @import url(http://fonts.googleapis.com/css?family=Nunito:300);


.homethree a { text-decoration: none; }
sup { font-size: 36px; font-weight: 100; line-height: 55px; }

.button
{
margin-top:30%!important;
text-transform: uppercase;
letter-spacing: 2px;
text-align: center;
color: #0C5;
font-size: 24px;
font-family: "Nunito", sans-serif;
font-weight: 300;
position:relative;
padding: 20px 0;
width: 220px;
height:30px;
background: #0D6;
border: 1px solid #0D6;
color: #FFF;
overflow: hidden;
transition: all 0.5s;
}

.button:hover, .button:active
{
text-decoration: none;
color: #0C5;
border-color: #0C5;
background: #FFF;
}

.button span
{

padding-right: 0;

transition: padding-right 0.5s;
}

.button span:after
{
content: ' ';

right: -18px;
opacity: 0;
width: 10px;
height: 10px;


background: rgba(0, 0, 0, 0);
border: 3px solid #FFF;
border-top: none;
border-right: none;

transition: opacity 0.5s, top 0.5s, right 0.5s;
transform: rotate(-45deg);
}

.button:hover span, .button:active span
{
padding-right: 30px;
}

.button:hover span:after, .button:active span:after
{
transition: opacity 0.5s, top 0.5s, right 0.5s;
opacity: 1;
border-color: #0C5;
right: 0;
top: 50%;
}
<div class="row text-center homethree">
<div class="col-md-4">
<h4 class="service-heading">A Range of Classes</h4>
<p class="text-muted">WE TEACH CHILDRENS CLASSES, FAMILY GROUPS & ADULTS.</p>
<a href="#" class="button"><span>page 1</span></a>
</div>
<div class="col-md-4">
<h4 class="service-heading">Passionate Instructors</h4>
<p class="text-muted">ALL OUR CLASSES ARE TAUGHT BY PASSIONATE, MOTIVATIONAL & INSPIRING INSTRUCTORS.</p>
<a href="#" class="button"><span>page 2</span></a>
</div>
<div class="col-md-4">
<h4 class="service-heading">Friendly Team</h4>
<p class="text-muted">NEW MEMBERS ARE ALWAYS WELCOME. TWO FREE LESSONS FOR ALL.</p>
<a href="#" class="button"><span>page 3</span></a>
</div>
</div>

最佳答案

问题是<a>标签是 inline元素。将它们更改为 inline-blockblock样式元素将使您的边距正确应用。

.button {
display: inline-block;
}

更多信息:The Difference Between “Block” and “Inline”

旁注,为什么不使用 <button>标签而不是 <a> ?他们会更合适。

关于html - 元素上边距似乎没有改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28807117/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com