Is it possible to make any CSS element behave like

前端 未结 4 1094
萌比男神i
萌比男神i 2021-02-06 20:40

I am loading some content inside an iframe. I want this content to behave as-if it was inside a

 tag - namely for it to respect line breaks.  I am using         


        
4条回答
  •  别那么骄傲
    2021-02-06 20:46

    If you're only interested in preserving line breaks but not whitespace then I suggest using:

    body {
        white-space: pre-line;
    }
    

    This will collapse multiple consecutive white space characters into one but preserve line breaks. The downside is that it's only supported in IE versions 8 and up.

提交回复
热议问题