How to line-break from css, without using
?

后端 未结 26 1648
攒了一身酷
攒了一身酷 2020-11-22 15:49

output:

hello
How are you

code:

hello
How are you

Ho

26条回答
  •  我在风中等你
    2020-11-22 16:40

    I'm guessing you did not want to use a breakpoint because it will always break the line. Is that correct? If so how about adding a breakpoint
    in your text, then giving it a class like
    then using media query right above the size you want it to break to hide the
    so it breaks at a specific width but stays inline above that width.

    HTML:

    The below line breaks at 766px.

    This is the line of text
    I want to break.

    CSS:

    @media (min-width: 767px) {
      br.hidebreak {display:none;}
    }
    

    https://jsfiddle.net/517Design/o71yw5vd/

提交回复
热议问题