开发者

How do I set a block of text to drop to a new line all at once?

开发者 https://www.devze.com 2022-12-21 22:32 出处:网络
I feel like there\'s a simple solution to开发者_开发百科 this, but I\'m not really sure how to phrase it in a search, so here we go...

I feel like there's a simple solution to开发者_开发百科 this, but I'm not really sure how to phrase it in a search, so here we go...

I have a forum-like display that shows a block of text with a user image, user name, and time stamp appended to the end of the text. Many times, part of the appended section gets dropped to a new line. This is especially annoying when the time stamp (which usually displays "8:25 PM, Mar 4") comes out as something like "8:25" {new line} "PM, Mar 4".

Is there either a tag or a css-trick that would drop an entire section of text to a new line all at once if any part of that section needs to drop?


You can give that element a style: white-space: nowrap;

If you always want it to drop, then display: block; as well.


And if you don't want it to drop, you can give n or more elements display: inline;.


There is also the entity   which represents a non breakable space.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号