Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS text overflows ooh man what a mess

I compiled this jsFiddle demo so that you can see what i am going throw. Using the Twitter Bootstrap 2 i thought everything was fine and simple things were taken care until i hit with this. I don't understand if the markup is not right or the library doesn't handle this but the text when long just overflows out of screen/container

JsFiddle

http://jsfiddle.net/kSCa3/2/

like image 627
Deeptechtons Avatar asked Feb 16 '12 09:02

Deeptechtons


People also ask

How do I keep text in one line in CSS?

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.

What causes overflow HTML?

An overflow issue occurs when a horizontal scrollbar unintentionally appears on a web page, allowing the user to scroll horizontally. It can be caused by different factors. It could occur because of unexpectedly wide content or a fixed-width element that is wider than the viewport.

How do I show half text in HTML?

The <sup> tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font.


3 Answers

Try this:

div {
  word-break: break-all;
  word-wrap: break-word;
}​
like image 87
Ketan Modi Avatar answered Sep 22 '22 23:09

Ketan Modi


Add word-wrap: break-word in your DIV. Write this:

.span9 {
    width: 700px;
    word-wrap: break-word;
}
like image 43
sandeep Avatar answered Sep 23 '22 23:09

sandeep


I have just spent almost an entire day trying to solve this, and the above didn't work until I discovered this:

Make certain you also have fluid containers INSIDE the floated div:

<div class="container-fluid">

Otherwise it'll stay the same width and will spill over .. no matter what you do.

like image 22
Ben Read Avatar answered Sep 23 '22 23:09

Ben Read