Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get button text on to one line

My button text appears on one line in safari (even after initial click) however on google chrome my button will appear on one line when you first get to the button however when you go through more posts and come across the load more button again the text is messed up. This only happens on google chrome.

when you get to the load more button the first time.. enter image description here

when you get to the load more button the second time..

enter image description here

here is my css... i've tried adding in width, although it solves the issue the button is then not centered

.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;
}
like image 649
user6738171 Avatar asked Dec 20 '16 18:12

user6738171


People also ask

How do I keep a button on one line of text?

You can just use non-breaking space ( ) between words in your html. It's rough but works in any browser. Also better to set left and right paddings inside the button.

How do you make a multiline button?

To make a multi-line text in UIButton, you insert a new line character ( \n ) wherever you want in button title and set lineBreakMode to byWordWrapping .


2 Answers

Would you like to try using:

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

While white-space: nowrap force the text in the button to never wrap, you can also make the button display as inline-block, so you don't have to give it a specific width.

like image 65
Ian.Wu Avatar answered Oct 06 '22 12:10

Ian.Wu


You can just use non-breaking space ( ) between words in your html. It's rough but works in any browser. Also better to set left and right paddings inside the button.

like image 40
Alexander Webmassa Avatar answered Oct 06 '22 13:10

Alexander Webmassa