CSS 9宫格边框

来源:互联网 发布:linux挂载分区命令 编辑:程序博客网 时间:2024/05/16 07:48

 

 制作8个图片,分别对应左上,上,右上,左,右,左下,下和右下。

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    
<title>CSS</title>
    
<style type="text/css">
        div#outer
        
{ background: url("images/top.gif") 0 0 repeat-x;  }
        div#outer div
        
{ background: url("images/bottom.gif") 0 100% repeat-x;  }
        div#outer div div
        
{ background: url("images/left.gif") 0 0 repeat-y;  }
        div#outer div div div
        
{ background: url("images/right.gif") 100% 0 repeat-y;  }
        div#outer div div div div
        
{ background: url("images/topleft.gif") 0 0 no-repeat;  }
        div#outer div div div div div
        
{ background: url("images/topright.gif") 100% 0 no-repeat;  }
        div#outer div div div div div div
        
{ background: url("images/bottomleft.gif") 0 100% no-repeat;  }
        div#outer div div div div div div div
        
{ background: url("images/bottomright.gif") 100% 100% no-repeat;  }
        
        div#outer, div#inner
        
{
            width
: 400px;
            height
: 300px;
        
}


        div#inner
        
{
            padding
: 15px;
        
}

    
</style>
</head>

<body>

    
<div id="outer">
        
<div>
            
<div>
                
<div>
                    
<div>
                        
<div>
                            
<div>
                                
<div id="inner">
                                    
                                    
<span>Some content here.</span>
                                    
                                
</div>
                            
</div>
                        
</div>
                    
</div>
                
</div>
            
</div>
        
</div>
    
</div>

</body>

</html>

 

 

原创粉丝点击