Css text in one line

I have a small issue with a title where I would like text to display on a single line rather than split onto two as im trying to arrange these blocks as a grid

jsFiddle

html


css

@import url(http://fonts.googleapis.com/css?family=Open+Sans);


.garage-row {
    border: 1px solid #FFFFFF;
    float: left;
    margin-right: 5px;
    padding: 12px;
    position: relative;
    width: 204px;
}
    .garage-row img{}
.garage-image {
    background-position: center center;
    display: block;
    float: left;
    max-height: 150px;
    max-width: 204px;
    overflow: hidden;
    position: relative;
}

.user-meta {
    background: none repeat scroll 0 0 #2C3539;
    color: #FFFFFF;
    float: left;
    padding: 10px;
    position: relative;
    width: 184px;
}
img {
    border-width: 0;
    height: auto;
    max-width: 100%;
    vertical-align: middle;
}
.garage-title {
    clear: both;
    display: inline-block;
    overflow: hidden;
}
.garage-row-title {
    font-size: 22px;
    font-weight: bold;
}
a:link {
    color: #43A6DF;
}
font-family: 'Open Sans',sans-serif;

I would greatly appreciate if someone were able to help me get the title into one line rather than two or even fix it so if the title exceeds the width then it gets ellipses.

Solutions with the CSS text-overflow property

If you want to limit the text length to one line, you can clip the line, display an ellipsis or a custom string. All these can be done with the CSS text-overflow property, which determines how the overflowed content must be signalled to the user.

Here, you will find all the three above-mentioned methods of limiting the text length to one line.

Example of limiting the text length to one line by clipping the line:

html>
<html>
  <head>
    <title>Title of the documenttitle>
    <style>
      div {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
      }
    style>
  head>
  <body>
    <div>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    div>
  body>
html>

Result

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

The white-space property with the “nowrap” value and the overflow property with the “hidden” value are required to be used with the text-overflow property.

Example of limiting the text length to one line by adding an ellipsis:

html>
<html>
  <head>
    <title>Title of the documenttitle>
    <style>
      .text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    style>
  head>
  <body>
    <div class="text">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    div>
  body>
html>

The value of the text-overflow property used in the next example adds strings at the end of the line only in Firefox.

Example of limiting the text length to one line by adding strings:

html>
<html>
  <head>
    <title> Title of the documenttitle>
    <style>
      div.text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: "----";
      }
    style>
  head>
  <body>
    <div class="text">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    div>
  body>
html>

How do I make text appear in one line in CSS?

The best way to use is white-space: nowrap; This will align the text to one line.

How do you make text stay in a line in CSS?

“force text to stay on one line css” Code Answer's.
width: 100px;.
white-space:nowrap;.
overflow:hidden;.
text-overflow:ellipsis;.

How do I put text on one line in HTML?

The defines a single-line text field.

How do I stop text from going to the next line in CSS?

If you want to prevent the text from wrapping, you can apply white-space: nowrap; Notice in HTML code example at the top of this article, there are actually two line breaks, one before the line of text and one after, which allow the text to be on its own line (in the code).