2012-06-06 99 views
3

我想爲表格中的按鈕應用背景圖片。代碼工作並且在所有瀏覽器(Chrome,FF,Opera和Safari)中都很完美。但是,在IE8(我查看的唯一版本)中,圖像正在重複。我試圖遵循標準和簡單的HTML和CSS,但這真的很煩人。請參考下面在Internet Explorer中重複的背景圖片

enter image description here

圖片以下是HTML

<div id="header"> 
      <div id="TopHead"> 
       <div id="logo"> 
        <a href="/" alt="eyaas"> 
         <img src="logo.gif" alt="eyaas" /> 
        </a> 
       </div> 
       <div id="country">India | Rest of the World 
       </div> 
       <div id="linksAndSearch"> 
        <div id="linksTop">My Account | Login | Register | Cart 
        </div> 
        <div id="searchBar"> 
         <form id="search_mini_form" action="" method="get" class="search"> 
          <div class="searchBox"> 
            <input id="Text1" type="text" name="" class="searchBoxDefaultText jsSearchTerm jsToggle" value="" /> 
          </div> 
          <div class="searchButton"> 
           <button type="submit" title="" class="searchBoxSubmitButton" /> 
          </div> 
          <div class="clear"></div> 
         </form> 
        </div> 
       </div> 
       <div class="clear"></div> 
      </div> 
      <div id="TopNav"> 
      </div> 
     </div> 

以下是CSS

#linksAndSearch { float:left; } 

.search { width:393px; height:35px; background-image:url('SearchBoxGrayFrameText.gif'); } 

.searchBox { float:left; margin:6px 0 0 65px; background-image:url('SearchBoxFramed.gif'); width:275px; height:23px; overflow:hidden; } 

.searchBox .searchBoxDefaultText { width:257px; height:19px; margin:2px 0 0 5px; font-size:15px; color:#CCC; } 

.searchButton { float:left; margin:6px 0 0 10px; } 

.searchBoxSubmitButton { width:29px; height:23px; background-image:url(SearchSubmitBtnYellowArrow.gif); background-repeat:no-repeat; } 
+0

一些類似的bug:http://haslayout.net/css/Float-Squeeze-Duplicate-Last-Character-Bug您的IE在IE8或IE7模式下運行(和/或其他任何兼容模式)? – biziclop

+0

我在正常模式下運行IE8 –

回答

0

問題是由

<button type="submit" title="" class="searchBoxSubmitButton"/> 

解決了

<button type="submit" title="" class="searchBoxSubmitButton"></button> 

有人能在這個問題上闡述爲什麼這是怎麼回事?

+0

因爲button是一個非void元素,需要一個結束標記 – albert