CSS布局-有头有尾左中右三分

要实现一个类似框架结构,有头有尾,中间部分要分菜单、分隔条和内容三部分。

写好的效果图如下:

 

 

下面是实现代码:(CSS和HTML放一个文件了)

 

 

ContractedBlock.gif ExpandedBlockStart.gif Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    
<title>Untitled</title>
    
<script src="jquery.js" type="text/javascript"></script>
<!--STYLE-->
ExpandedBlockStart.gifContractedBlock.gif
<style>
div
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    margin
: 0px;
}

ExpandedSubBlockStart.gifContractedSubBlock.gif.divWrap
{}{
height
:100%;
background
:#ccc;
margin-left
:205px;
}

ExpandedSubBlockStart.gifContractedSubBlock.gif.divWrap .divleft
{}{
    float
:left;
    background
:#FF7400;
    height
:100%;
    width
:205px;
    margin-left
:-205px;
ExpandedSubBlockStart.gifContractedSubBlock.gif    display
:inline;    /**//*下面这两行解决IE6双倍Margin的问题*/
    position
:relative;
}


ExpandedSubBlockStart.gifContractedSubBlock.gif.divWrap .divright
{}{
    float
:right;
    background
:#fefefe;
    height
:100%;
    width
:100%;
}


.divWrap .divright .divInnerWrap
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    height
:100%;
    margin-left
:10px;
}

.divWrap .divright .divInnerWrap .divInnerLeft
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    position
:relative;
    float
:left;
    background
:red;
    height
:100%;
    width
:10px;
    margin-left
:-10px;
    border
:solid 1px red;
}

.divWrap .divright .divInnerWrap .divInnerRight
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    float
:right;
    background
:white;
    height
:100%;
    width
:100%;
}

.divWrap .divright .divInnerWrap .divInnerRight .divContainer
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    margin 0px;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//*color:blue;*/
}

ExpandedSubBlockStart.gifContractedSubBlock.gif.dheader
{}{
background
:#eee;
height
:50px;
}

ExpandedSubBlockStart.gifContractedSubBlock.gif.dfooter
{}{
background
:#eee;
height
:50px;
}


body
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    margin
: 0px;
}


a.line
ExpandedSubBlockStart.gifContractedSubBlock.gif
{}{
    color
:blue;
    cursor
:hand;
}


</style>

</head>

<body>
<!--HTML--> 
<div id="all" >
    
<div class="dheader">header
    
</div>
    
<div class="divWrap">
        
<div class="divleft">我是左边<br><br><br><br><br></div>
        
<div class="divright">
            
<div class="divInnerWrap">
                
<div class="divInnerLeft"><href="#" class="line">&gt;</a></div>
                
<div class="divInnerright">
                    
<div class="divContainer">
                        这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀这里是内容呀
                    
</div>
                
</div>
                
<div style="clear:both"></div>
            
</div>
        
</div>
        
<div style="clear:both"></div>
    
</div>
    
<div class="dfooter">footer
    
</div>
</div>
 
<!--JS-->
ExpandedBlockStart.gifContractedBlock.gif
<script stype="text/javascript">
    
var height = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
    height 
= height - 100;
    $(
"#all").css("height",height + 'px');
</script>


</body>
</html>

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值