2012-05-18 16 views
0

如何實現老瀏覽器的邊界圖像?
我有8個圖像:
4邊界圖像(border-top.gif,border-right.gif,border-bottom.gif,border-right.gif)
和4邊框conners(conners的外部是透明的,這一點很重要):邊界頂級left.gif,邊框頂部right.gif,下邊框-right.gif,邊框底部left.gif,我也有下一個標記:老瀏覽器的邊界圖像實現

<div class"block"> 
    <div class="content">A lot of text with images and tables</div> 
    <div class="border-top"></div> 
    <div class="border-right"></div> 
    <div class="border-bottom"></div> 
    <div class="border-left"></div> 
    <div class="border-top-left"></div> 
    <div class="border-top-right"></div> 
    <div class="border-bottom-right"></div> 
    <div class="border-bottom-left"></div> 
</div> 

任何CSS解決方案?如果需要,我可以添加類到標記。
UPD:我知道這很容易做表,但我想找到div的解決方案。
UPD2:圖像具有漸變,所以沒有辦法做到沒有圖像。

+0

你創建圓角邊框?或只是定期的邊界?我不明白爲什麼你不能使用邊框:1px solid#000;定期...否則爲圓我建議http://css3pie.com/是否所有的圖像是透明的? –

+1

您可能還想看看http://cssround.com/ –

+0

這實際上取決於您的邊框是如何設計的。在大多數情況下,你甚至不需要圖像,但在一些情況下,它只是沒有辦法繞過它...另外,對於舊版本的瀏覽器,我假設你的意思是IE6和IE7 –

回答

1
  • 您的容器(.block)
  • 容器內的角落div元素的絕對定位的相對定位。

    <style type="text/css"> 
        .block { display:block;position:relative; } 
        .border-top-left { 
          display:block; 
          background-image:url(/folder/topleftcorner.png); 
          background-repeat:no-repeat; 
          width:10px; height:10px; /* size of your corner graphic above */ 
    
          /* this puts it where you want it */ 
          position:absolute; 
          top:0; 
          left:0; 
    
         } 
    </style> 
    

從使用...

 right:0; bottom:0 

匹配了休息,以適應

+0

我開始從它,但我不知道如何把非角落邊界,ammm我知道如何做到這一點,但頂部邊框是可見的conners的透明部分。在:( –

+0

這個問題增加的z-index:1,Z-指數:2,以滿足 - (2作爲頁面比1上更高)的CSS,聽起來像你,你需要訂購(z索引)堆疊順序以適合z-index是我們的第三維.. whahayyyy –

+0

所以頂部邊框應該有寬度= 100% - 32px * 2(32px - 我的角落大小) –