user10948074
user10948074

Reputation:

Change the way the text is display on screen with html and css

I am setting up a simple blog website and need help formatting the posts that are submitted to the front page of the site.

Upvotes: 0

Views: 1333

Answers (3)

John Rhoy Gadot
John Rhoy Gadot

Reputation: 74

You should add a word-wrap css property and set it to break-word. This forces the text to wrap inside a container.

.container {
    word-wrap: break-word;
}

Upvotes: 0

Waqas Kanju
Waqas Kanju

Reputation: 94

You have many options for this. simple one put you text in a <div> tag and give width to div as much you like.

<div style="width:100px">"Hello, this is my first post. As you can see, it wraps all the way around the text box and into another line."</div>

Upvotes: 0

Synthiatic
Synthiatic

Reputation: 261

You can achieve this in multiple ways. Maybe the easiest way is to put your text in a container and give this a width. The text will wrap itself.

<div class="text">Your text here</div>

and your CSS. If you want to break within the word you can use word-wrap:break-word;.

.text {
    width: 100px;
}

Upvotes: 1

Related Questions