获取按钮文本到一行

问题描述 投票:3回答:2

我的按钮文字出现在safari中的一行(即使在初次点击之后)但是在谷歌浏览器上我的按钮将在您第一次到达按钮时出现在一行上但是当您浏览更多帖子并再次遇到加载更多按钮时搞砸了。这只发生在谷歌浏览器上。

当你第一次到达加载更多按钮时... enter image description here

当你第二次到达加载更多按钮时..

enter image description here

这是我的CSS ...我已经尝试添加宽度,虽然它解决了问题,然后按钮不居中

.elm-wrapper {
margin: 1em auto;
text-align: center;
}

.elm-button {
-webkit-transition: all 0.15s ease;
transition: all 0.15s ease;
background-color: #ffffff;
text-shadow: none;
    box-shadow: none;
    border: none;
    padding-top: 45px;
    padding-bottom: 25px;
font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    font-size: 19px;
    color: #848484;
    outline: none;
}

.elm-button.ajax-inactive {
display: none;    
}
.elm-button.is-loading .elm-button-text {
	display: none;
}

.elm-loading-anim {
	display: none;
}

.elm-button.is-loading .elm-loading-anim {
display: block;
}


.elm-loading-icon {
width: 1.5em;
height: 1.5em;
}
.elm-button:not(.is-loading)::before {
            content: "v"; 
    font-size:11px;
    float: right;
    margin: 6px 0 0 16px;
    font-family: 'Days One', sans-serif;
}
css wordpress button alignment width
2个回答
6
投票

您想尝试使用:

.btn {
   white-space: nowrap;
   text-align: center;
}

虽然white-space: nowrap强制按钮中的文本永远不会换行,但你也可以将按钮display设为inline-block,这样你就不必给它一个特定的宽度。


0
投票

您可以在html中的单词之间使用不间断的空格()。它很粗糙但适用于任何浏览器。最好在按钮内设置左右填充。

© www.soinside.com 2019 - 2024. All rights reserved.