简体   繁体   中英

Break word with CSS?

I work with a web site and i have many long word in my menu. I would like to display them in two line but not one. I used word-wrap proprety in CSS.

{word-wrap: break-word}

But this property breaks the word.

For example I have : Solution for enterprise

When I use the word-wrap property I get this :

Solution for enter
prise

Whereas I would like to have:

Solution
for enterprise

Thanks

Various options, some mentioned in the comments:

  • set a width on the link wrapper ( li or whatever) so that the words naturally wrap;
  • add a <br> element where you want the words to wrap;
  • wrap a span around the word(s) to wrap and set the span to display: block .

请改用CSS的空白属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM