The code below

// Improve readability of pre-formatted text in all browsers.
    pre {
      white-space: pre;
      white-space: pre-wrap;
      word-wrap: break-word;
    }

is taken from https://github.com/yuanyan/pre/blob/master/src/normalize.less

Could anybody please tell me why do we need this

  white-space: pre;

as the second line overrides it. I know it is needed, but who can tell me why? Is that because of the browser support? Probably not the way it is used here. What's the sense to override values?

P.S. The pre-wrap property is supported in IE8 and higher, but not IE 5-7 -that's what Alex W says here @ SO

有帮助吗?

解决方案

pre-wrap wasn't supported by all browsers. These days every browser support it. So it's just a fallback for old browsers.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top