Keeping a string of text together on one line

后端 未结 2 533
小鲜肉
小鲜肉 2021-02-05 01:46

Is there a way to keep a string of text on one line, so that if the div width gets to small, the whole string will drop to the next line instead of half of it?

Example:

相关标签:
2条回答
  • 2021-02-05 02:28

    You want to use a non-breaking space in your HTML markup   instead of a normal space.

    HTML

    "Industry Updates - 8th September 2013" 
    
    0 讨论(0)
  • 2021-02-05 02:45

    CSS

    .nowrap {
        white-space: nowrap;
    }
    

    HTML

    <span class="nowrap">Industry Updates -</span>
    <span class="nowrap">8th September 2013</span>
    

    Any element with white-space: nowrap stays on one line

    0 讨论(0)
提交回复
热议问题