gpt4 book ai didi

css - 如何让按钮留在同一个盒子里?

转载 作者:太空宇宙 更新时间:2023-11-04 08:04:59 25 4
gpt4 key购买 nike

我创建了一个按钮,但每当我缩小窗口时,该按钮就无法使用。它看起来不太好。我想知道如何让我的按钮留在盒子里。查看图片以更好地理解。我提供了按钮的 CSS。我不确定如何为这个问题实现一个好的和有效的解决方案。我能够通过将宽度更改为 100% 来解决我的问题。现在我的信从我的底部被切断了。请看图!

Full Screen

Half size of screen

Letter are getting cut off

.button {
display: inline-block;
position: relative;
cursor: pointer;
outline: none;
white-space: nowrap;
// margin: 5px;
padding: 0 22px;
font-size: 14px;
font-family: 'Roboto', sans-serif, 'Lato';
height: 40px;
width: 220px;
line-height: 40px;
background-color: #428bca;
color: #FFF;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
border: none;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
margin: 0 auto;
text-align: center;

}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: #ffffff;
}

.panel-heading {

color: #428bca;
background-color: #428bca;
border-top: 1px solid #dddddd;
border-left: 1px solid #dddddd;
border-right: 1px solid #dddddd;
//border-top-right-radius: 3px;
//border-top-left-radius: 3px;
}

.panel-body {
padding: 15px;
border: 1px solid #dddddd;
}
.nobottommargin {
margin-bottom: 0 !important;
}
.leftmargin-sm {
margin-left: 30px !important;
}

.button.button-rounded {
border-radius: 3px;
}

.button.button-reveal {
padding: 0 28px;
overflow: hidden;
}

.button.button-large {
padding: 0 26px;
font-size: 16px;
height: 46px;
line-height: 46px;
}

.button-teal {
background-color: #428bca;
}

/*code for the icon */
.button-reveal i {
position: absolute;
width: 2em;
height: 100%;
line-height: 45px;
background-color: rgba(0, 0, 0, .2);
text-align: center;
left: -100%;
transition: left 0.25s ease;
}
.button-reveal:hover i {
left: 0;
}
/* code for the letters*/
.button-reveal span {
display: inline-block;
margin: 0 2em;
transition: margin 0.35s ease;
}
.button-reveal:hover span {
margin: 0 1em 0 3em;
}
<div class="panel-heading">
<h2 class="panel-title">Access This Service</h2>
</div>

<div class="panel-body">
<!-- angular -->

<div ng-if="c.html" ng-bind-html="c.html"></div>

<a href="http://zoom.us" class="button button-rounded button-reveal button-large button-teal"><i class="fa fa-forward" aria-hidden="true"></i>
<span>Go there now!</span></a><br>

Note: If you haven’t accessed Zoom before, create a new account at <a href="http://zoom.us">zoom.us</a>.
</div>

最佳答案

.button {
box-sizing: border-box; /* Include padding within the button's width */
width: 100%; /* Made the button the full width of its parent */
padding: 0 22px; /* Add 22 pixels of padding to the left and right of the button */
}

你可能不需要填充,所以你可以这样做:

button {
width: 100%;
padding: 0;
}

关于css - 如何让按钮留在同一个盒子里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46718146/

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