html (+css): denoting a preferred place for a line break

前端 未结 9 1652
南旧
南旧 2020-11-28 03:08

Let\'s say I have this text that I want to display in an HTML table cell:

Honey Nut Cheerios, Wheat Chex, Grape-Nuts, Rice Krispies, Some random cereal with          


        
9条回答
  •  被撕碎了的回忆
    2020-11-28 03:43

    New answer now we have HTML5:

    HTML5 introduces the tag. (It stands for Word Break Opportunity.)

    Adding a tells the browser to break there before anywhere else, so it's easy to make words break after commas:

    Honey Nut Cheerios, Wheat Chex, Grape-Nuts, Rice Krispies, Some random cereal with a very long name, Honey Bunches of Oats, Wheaties, Special K, Froot Loops, Apple Jacks
    

    It is supported my all major browsers apart from IE.

提交回复
热议问题