How to line-break from css, without using
?

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

output:

hello
How are you

code:

hello
How are you

Ho

26条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 16:25

    Setting a br tag to display: none is helpful, but then you can end up with WordsRunTogether. I've found it more helpful to instead replace it with a space character, like so:

    HTML:

    Breaking
    News:
    BR
    Considered
    Harmful!

    CSS:

    @media (min-device-width: 1281px){
        h1 br {content: ' ';}
        h1 br:after {content: ' ';}
    }
    

提交回复
热议问题