2012-05-18 20 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 - 我的角落大小) –