Reputation: 3
I am using captions on images in my website. The captions are in the bottom, and what I don't like is that when a caption is long, (the maximum is 2 lines in my case) the text wraps in such a way that I have a long first line and a short second line.
I don't like this:
"aaaaa aaaa aaaa aaaa
aaaa "
I am trying to get something like this:
"aaaaa
aaaa aaaa aaaa aaaa"
Any suggestions how I would achieve this kind of wrapping with CSS?
Upvotes: 0
Views: 484
Reputation: 58
Simply use HTML5 syntax to deal with this issue.
The <br>. or <br/>
element designates an opportunity where content may wrap to maintain legibility. Keep in mind this is HTML5 only.
Upvotes: 1
Reputation: 6199
I don't think this is a problem for css. you need to do some pre or post processing on the string using javascript or c# or whatever server language you are using. you have to calculate where you want the breaks based on string size and add <br/>
tag or possibly the newline character.
Upvotes: 0