是否可以使任何CSS元素的行为像< pre> [英] Is it possible to make any CSS element behave like <pre>

查看:125
本文介绍了是否可以使任何CSS元素的行为像< pre>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iframe中加载某些内容。我想要这个内容的行为,如果它在一个< pre> 标签 - 也就是为了它遵守换行符。我使用javascript来设置这个iframe的body元素的样式。

I am loading some content inside an iframe. I want this content to behave as-if it was inside a <pre> tag - namely for it to respect line breaks. I am using javascript to set the style of the body element of this iframe.

我想知道是否可以设置一个特定的风格,这个iframe的行为就像< pre />

I am wondering if it would be possible to set a particular style that will cause the body of this iframe to act like it's inside <pre/>.

推荐答案

p>您可以在 http://www.w3.org找到默认设置或其设置方式/TR/CSS2/sample.html 只是将相同的样式应用到要作为前置元素的元素,并完成

you can find the default setting or how they're suppose to be at http://www.w3.org/TR/CSS2/sample.html just apply the same style to the element you want to behave as a pre element and voila you're done

ps这基本上是

pre{ white-space: pre ; display: block; unicode-bidi: embed }

这篇关于是否可以使任何CSS元素的行为像&lt; pre&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆