Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
HTML+CSS和DIV如何实现排版布局_创想鸟

HTML+CSS和DIV如何实现排版布局

这篇文章主要介绍了关于html+css和div如何实现排版布局,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

HTML CSS + div实现排版布局

1.网页可以看成是由一个一个“盒子”组成,如图:

496770612-5b46ce6edc7b8_articlex[1].jpg

由上图可以看出,页面分为上(网站导航)、中、下(版权声明)三个部分,
中间部分又分为左(商品分类)、中(主要部分)、右,这些版块就像一个个
的盒子,这些”盒子”中放置着各种内容,页面就是由这些”盒子”拼凑起来

案例布局分析:

1376923543-5b46cf378eab4_articlex[1].jpg

立即学习“前端免费学习笔记(深入)”;

单列布局案例:

代码如下:
                    单列布局                body{            margin:0;        }        .box{            width:960px;            margin:0 auto;        }        .box .header{            height:120px;            border:1px solid #f00;            line-height:120px;        }        .box .main{            height:300px;            border:1px solid #0f0;            line-height:300px;        }        .box .footer{            height:100px;            border:1px solid #00f;            line-height:100px;        }        p{            text-align:center;        }                            

头部

主题

运行结果:

4125081848-5b46d0aebc53f_articlex[1].png

双列布局案例:

代码如下:
                    双列布局                body{        margin:0;        }        .box{            width:80%;            margin:0 auto;            overflow:hidden;        }        .box .left{            width:30%;            height:400px;            background-color:#0f0;            float:left;        }        .box .right{            width:70%;            height:400px;            background-color:#f00;            float:left;        }                        

运行结果如下图:

644704244-5b46d3b9c6eac_articlex[1].png

三列布局案例:

代码如下:
                    三列布局            body{        margin:0;    }    .box{        width:960px;        margin:0 auto;        position:relative;    }    .box .left{        width:200px;        height:400px;        background-color:#0f0;        position:absolute;    }    .box .center{        height:400px;        background-color:#00f;        margin:0 300px 0 200px;    }    .box .right{        width:300px;        height:400px;        background-color:#f00;        position:absolute;        right:0;        top:0;    }                        

运行结果如下图:

301091421-5b46d50ad43e5_articlex[1].png

混合布局案例:

代码如下:
                    混合布局            body{        margin:0;    }    .box{        width:960px;        margin:0 auto;    }    .header{        height:120px;        background-color:#ddd;        }    .main{        height:400px;        background-color:#f00;        position:relative;    }    .main .left{        width:200px;        height:400px;        position:absolute;        left:0;        top:0;        background-color:#0fccaa;    }    .main .center{        height:400px;        margin:0 305px 0 205px;        background-color:#123456;    }    .main .right{        width:300px;        height:400px;        position:absolute;        right:0;        top:0;        background-color:#ff0;    }    .footer{        height:80px;        background-color:#ddd;    }                        

运行结果如下图:

2619066118-5b46d5e7b3d8f_articlex[1].png

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!

相关推荐:

详解前端在html页面之间传递参数的方法

以上就是HTML+CSS和DIV如何实现排版布局的详细内容,更多请关注php中文网其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1546395.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
如何使用html中table实现td边框的效果(代码)
上一篇 2025年12月21日 18:11:14
HTML5新特性之离线缓存技术-php中文网
下一篇 2025年12月21日 18:11:25

相关推荐

发表回复

登录后才能评论
关注微信