[英]Text wrapping incorrectly in Internet Explorer
為用戶提供幫助-當用戶單擊問號時,將顯示一個div:
一個javascript函數使div出現:
function showhelpby(whichdiv,e,divwidth,leftorright,message)
{
e=(!e)?window.event:e;//IE:Moz
document.getElementById(whichdiv).style.display = 'block';
document.getElementById(whichdiv).style.width = divwidth + 'px';
if (leftorright == 'left')
{
if (e.pageX)
{
document.getElementById(whichdiv).style.left = e.pageX - divwidth - 20 + 'px';
document.getElementById(whichdiv).style.top = e.pageY + 'px';
}
else if(e.clientX)
{
document.getElementById(whichdiv).style.left = window.event.clientX - divwidth - 20 + 'px';
document.getElementById(whichdiv).style.top = window.event.clientY + 'px';
}
}
else
{
if (e.pageX)
{
document.getElementById(whichdiv).style.left = e.pageX + 20 + 'px';
document.getElementById(whichdiv).style.top = e.pageY + 'px';
}
else if(e.clientX)
{
document.getElementById(whichdiv).style.left = window.event.clientX + 20 + 'px';
document.getElementById(whichdiv).style.top = window.event.clientY + 'px';
}
}
document.getElementById('message').innerHTML = message;
}
出現的div的CSS為:
div.notes
{
font-family: Verdana;
font-size: 12px;
color: #000066;
line-height:140%;
display:none;
border-style:solid;
border-width:2px;
border-color:#000099;
position:absolute;
padding:15px;
background-color:#FFFFFF;
background-image:url(images/F3F3F3White200.jpg);
background-repeat:repeat-x;
overflow-y:auto;
overflow-x:hidden;
z-index:201;
}
並且div中顯示的文本位於<p>
標記中,未應用任何CSS樣式。
多年來,我一直在使用上面的方法來顯示彈出的“幫助” div。
現在,突然之間,在Visual Studio 2010中開發一個網站-在Intranet上使用-正在使用IE 9(我們必須使用IE)進行查看(發布后)-我的幫助div中的文本不能正確包裝。 文字顯得有道理,單詞隨處中斷 。 這與長單詞不間斷無關。 單詞“ the”可能以一行中的“ t”和另一行中的“ he”結尾。
除了通常所說的“ blood Internet Explorer –他們做得還不錯嗎?”之外, -有人知道我需要做些什么才能使文本基本固定在固定寬度div中嗎?
您是否嘗試添加斷字:正常? http://www.w3schools.com/cssref/css3_pr_word-wrap.asp
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.