Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make div break line?

Tags:

html

css

I have the following code:

.thing {
  width: 90%;
  height: 400px;
  border: 10px solid #000;
}
<div class="thing">
  aaaaaaaaaaaa
</div>

The problem is that when I add to much content, the text goes out of the div!

How to fix this using only CSS?

like image 800
Luis Parker Avatar asked Jun 11 '13 16:06

Luis Parker


People also ask

How do you put a line break in a div?

You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard.

How do you force a line break?

Press ALT+ENTER to insert the line break.

How do I make a line break in HTML?

To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break. Since an HTML line break is an empty element, there's no closing tag.

How do I make a line break in CSS?

A line-break can be added in HTML, using only CSS, by employing the pseudo-class ::after or ::before . In the stylesheet, we use these pseudo-classes, with the HTML class or id, before or after the place where we want to insert a line-break. In myClass::after : Set the content property to "\a" (the new-line character).


1 Answers

.thing {
width: 90%;
height: 400px;
padding: 10px solid #000;
word-break:break-all;
}

use word-break

like image 66
Bhushan Kawadkar Avatar answered Oct 11 '22 20:10

Bhushan Kawadkar