2015-04-14 56 views
0

這是我嘗試使用的應用程序的一個示例。 在IE10中的GUI(無兼容模式)與IE9中的GUI應該相同。但在IE10中,「ADD」標籤的背景圖像尺寸正在縮小。 我無法找到確切的原因。 很少有解決方案建議我必須提供明確的「高度」和「寬度」參數,但這也沒有幫助。從IE9(java代碼)在IE10中減少背景圖像尺寸

我不明白我在做錯的方式。謝謝。 的JSP代碼如下:

<html> 
<head> 
<style> 
.buttonM{ 
    color: red; 
    padding-top: 4px; 
    font-family: "Verdana"; 
    font-size: 8pt; 
    cursor: hand; 
    background-image:url("images/buttonM.png"); 
    background-repeat: no-repeat; 
    } 

.buttonMOver{ 
    color: white; 
    padding-top: 4px; 
    font-family: "Verdana"; 
    font-size: 8pt; 
    cursor: hand; 
    background: url("images/buttonM.png") no-repeat ; 
    background-repeat: no-repeat; 
    } 

    table, th, td{ 
    border: 1px solid black; 
    } 

    label{ 
    height: 23; 
    text-align: center 
    } 
</style> 
<script> 
    function fnButtonClicked(){ 
    alert("button clicked"); 
    } 
</script> 
<title>trial</title> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<meta name="GENERATOR" 
    content="Rational® Application Developer for WebSphere® Software"> 
</head> 
<body> 
    <table> 
    <tr height="40"> 
     <td> 
     Name: 
     </td> 
     <td> 
     <input type="text"> 
     </td> 
    </tr> 
    <tr height="40"> 
     <td> 
     Number: 
     </td> 
     <td> 
     <input type="text"> 
     </td> 
    </tr> 
    <tr height="40"> 
     <td align="center" colspan="2"> 
     <label class="buttonM" 
       style="width: 80; height: 23;" 
       onmouseover="this.className='buttonMOver';" 
       onmouseout="this.className='buttonM';" 
       onclick="javascript:showDetailsPopUp();"> 
       ADD 
      </label> 
     </td>     
    </tr> 
</table> 
</body> 
</html> 

回答

0

我用,而不是 '標籤' 標籤 '的div' 標籤。解決了這個問題。

0

對我來說,好像你還沒有設置元素的寬度PARAM,因此它設置爲默認這是隻有儘可能您的文本表示。當我錯過寬度/高度或某些元素時,我通常遇到了IE的這些問題。

嘗試設置按鈕樣式和按鈕所在位置的寬度和高度參數。

<label class="buttonM" 
      style="width: 80px; height: 23px;"> 

您以像素(通常)定義寬度和高度。這也可以。在最上面的部分中,至少用像素來定義它們。後來你似乎忘了它。

嘗試改變<td align="center" colspan="2"><td align="center" colspan="2" width="80" height="23">

嘗試寬度增加標籤類:

label{ 
    height: 23 px ; <-- missing px unit 
    text-align: center; 
    width: 80 px ; 
    } 

你也可以定義你的TR標籤,以避免全部重新寫同樣的東西:

tr{ 
    height: 40px; 
} 

稍後修改內容會更簡單。

您還可以更改padding-top: 4px;到:padding: 4px 20px 4px 20px;這裏:

.buttonM{ 
    color: red; 
    padding-top: 4px; 
+0

沒有添加任何單獨的按鈕。它是一個包含文本的表格單元格中的標籤類。所以我已經給出了不用幫助的高度和寬度參數。你的意思是說我在'buttonM'類中添加這些參數嗎? –

+0

在定義按鈕尺寸 – Dashovsky

+0

後,您錯過了像素單位,但無法使用。它仍然是一樣的。 –