我设计了一个 html iframe,我想在其中使用 word-wrap 属性,即,它应该将长单词分到下一行。但相反的是,对于长词,它会添加一个水平滚动条,而不是将单词分到下一行。
我尝试使用“溢出:隐藏”属性隐藏滚动条,但没有任何反应。
我可以在这里使用一些帮助。
这是 iframe 的 html 代码:
<div id="main_frame" >
<iframe id="main_frame" src="homedept.php" name="iframe_a"></iframe>
</div>
CSS是:
div#main_frame
{
float: left;
margin-top:198px;
margin-left:5px;
float:left;
position:relative;
width:100%;
height:900px;
z-index: 0;
word-wrap:break-word;
}
iframe#main_frame
{
float:left;
margin-left: 30px;
margin-right: 300px;
float:left;
border:none;
word-wrap:break-word;
width: 78%;
height:70%;
z-index: 1;
}
感谢@tyriar 的回复,我现在已将自动换行属性设置为原始页面。仍然没有任何反应。
<div id="display_posts">
<?php //php echoes some text here ?>
</div>
CSS代码是:
#display_posts
{
word-wrap:break-word;
}