Reputation: 6815
I have a div
with below content.
hai hello ho
w are you wh
ere are you?
But I want the word to appear in next line instead of breaking as below.
hai hello
how are you
where are
you?
What CSS style do I need to apply?
Thanks!
Upvotes: 0
Views: 89
Reputation:
Put it in
<p>
tags and if you want to make sure it won't break mid-word with CSS use the style of
word-wrap:normal
on your paragraph, although the p tag alone should do it for you
Upvotes: 1
Reputation: 2102
<br>
, but this is not professional way<p>
hai hello
<br>how are you
<br>where are
<br>you?
</p>
max-width
p {
max-width: 70px;
}
<p>
hai hello how are you where are you?
</p>
rest of the methods are using jQuery/JavaScript, But I don't suggest you to include JS for this :)
Upvotes: 2
Reputation: 152
You can use the following ccs:
.wrap {
word-wrap: break-word;
width: 100px;
}
With the following html:
<div class="wrap">
hai hello how are you where are you?
</div>
Upvotes: 3