gpt4 book ai didi

html - 如何将按钮右对齐?

转载 作者:行者123 更新时间:2023-11-28 01:02:37 26 4
gpt4 key购买 nike

下午好,我意识到这个话题已经被问过好几次,并且有几个解决方案,正如我在搜索你们的论坛时看到的那样。

但是解决方案,例如, <input type="button" value="Click Me" **style="float: right;"**> ,

即使按钮成功地向右对齐,它们也会与我的页脚重叠,因为按钮应该位于页脚的正上方。这是我的代码:

.button {
border-radius: 4px;
background-color: #0FA0FF;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 15px;
padding: 10px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.containers-fluid {
padding: 20px 50px;
background-color: #000000;
color: white;
}
<button class="button"><span>Proceed to Next Lesson </span>
</button>

<footer class="containers-fluid text-center">
</footer>

最佳答案

只需将样式 float:right 添加到您的 button

buttonfooter 之间添加这个

<div class="clearfix"></div>

clearfix 的 css

.clearfix{
clear: both;
}

阅读更多关于 clearfix 的信息

.button {
border-radius: 4px;
background-color: #0FA0FF;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 15px;
padding: 10px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
float: right;
display: block;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.containers-fluid {
padding: 20px 50px;
background-color: #000000;
color: white;
}
.clearfix{
clear: both;
}
<button class="button"><span>Proceed to Next Lesson </span>
</button>
<div class="clearfix"></div>
<footer class="containers-fluid text-center">
</footer>

关于html - 如何将按钮右对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41407840/

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