div css 设置三列,左右固定宽度,中间自定义宽度,代码如下。 <div class="footer"> <div class="footer-l
<divclass="footer"><divclass="footer-left"></div><divclass="footer-center"></div><div...
<div class="footer">
<div class="footer-left"></div>
<div class="footer-center">
</div>
<div class="footer-right"></div>
</div>
css 代码如下。
.footer {position:absolute;bottom:0px;height:46px;}
.footer-left,.footer-right,.footer-center{height:46px;}
.footer-left{width:32px;float:left;background:url(../images/footer_left.jpg) no-repeat;margin:0px 0 0 0;overflow:inherit;}
.footer-center{width:inherit;background:url(../images/footer_bg.jpg) repeat-x;margin:0;padding:0 0px 0 0px;overflow:auto;}
.footer-right{width:22px;float:right:background:url(../images/footer_right.jpg) no-repeat;margin:0px 0 0 0;overflow:inherit;}
上面这个代码是我参考别的教程写的,但总不对,谁帮我重写下,或指出其中的错误。
footer {position:absolute;bottom:0px;height:46px;width:宽度值;overflow:hidden;}
这样就可以了
如果固定footer的宽度,那这样做哪还有啥意思 展开
<div class="footer-left"></div>
<div class="footer-center">
</div>
<div class="footer-right"></div>
</div>
css 代码如下。
.footer {position:absolute;bottom:0px;height:46px;}
.footer-left,.footer-right,.footer-center{height:46px;}
.footer-left{width:32px;float:left;background:url(../images/footer_left.jpg) no-repeat;margin:0px 0 0 0;overflow:inherit;}
.footer-center{width:inherit;background:url(../images/footer_bg.jpg) repeat-x;margin:0;padding:0 0px 0 0px;overflow:auto;}
.footer-right{width:22px;float:right:background:url(../images/footer_right.jpg) no-repeat;margin:0px 0 0 0;overflow:inherit;}
上面这个代码是我参考别的教程写的,但总不对,谁帮我重写下,或指出其中的错误。
footer {position:absolute;bottom:0px;height:46px;width:宽度值;overflow:hidden;}
这样就可以了
如果固定footer的宽度,那这样做哪还有啥意思 展开
2个回答
展开全部
为了看到清楚预览效果,我都加了边框,你到时候去掉就行了
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.footer{position:absolute;bottom:0px;height:46px;}
.footer-left,.footer-right,.footer-center{height:46px; border:1px #ccc solid}
.footer-left{width:32px;float:left;background:url(../images/footer_left.jpg) no-repeat;margin:0px 0 0 0;overflow:hidden}
.footer-center{width:auto;overflow:auto; float:left;background:url(../images/footer_bg.jpg) repeat-x;margin:0;padding:0 0px 0 0px;}
.footer-right{width:22px;float:right;background:url(../images/footer_right.jpg) no-repeat;margin:0px 0 0 0;overflow:hidden}
-->
</style>
</head>
<body>
<div class="footer">
<div class="footer-left"></div>
<div class="footer-center">
gjhgjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffffffffffffffffffffffffffffffffffffffffffffjjjjjjffffffffffffffffffffffffffffffffffffffffffffjjjjj
</div>
<div class="footer-right"></div>
</div>
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.footer{position:absolute;bottom:0px;height:46px;}
.footer-left,.footer-right,.footer-center{height:46px; border:1px #ccc solid}
.footer-left{width:32px;float:left;background:url(../images/footer_left.jpg) no-repeat;margin:0px 0 0 0;overflow:hidden}
.footer-center{width:auto;overflow:auto; float:left;background:url(../images/footer_bg.jpg) repeat-x;margin:0;padding:0 0px 0 0px;}
.footer-right{width:22px;float:right;background:url(../images/footer_right.jpg) no-repeat;margin:0px 0 0 0;overflow:hidden}
-->
</style>
</head>
<body>
<div class="footer">
<div class="footer-left"></div>
<div class="footer-center">
gjhgjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffffffffffffffffffffffffffffffffffffffffffffjjjjjjffffffffffffffffffffffffffffffffffffffffffffjjjjj
</div>
<div class="footer-right"></div>
</div>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询