介绍
这篇文章将为大家详细讲解有关的HTML如何在两个div标签中间画一条竖线,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
在两个子p中加多一个p,并设置左(右)边框为可见,并且利用利用padding-bottom | margin-bottom正负值相抵消的原理,例如设置,,<代码> padding-bottom: 1600 px;margin-bottom: -1600 px> 代码;我们可以理解为:运用的是填充可以撑开外层标签而保证金不用来撑开外层标签。即当padding-bottom时撑开外层标签的高度,外层标签用溢出:隐藏;隐藏掉多余的高,这样可以让高度与最高的那一栏对齐,而边缘关乎模块布的局,保证金可以抵消掉填充撑开的盒子使布局能够从内容部分开始。
以下是代码:
身体{ margin-top: 100 px; margin-left: 200 px; } .mainp { 宽度:900 px; 填充:10 px; 溢出:隐藏;/*关键*/边界:1 px固体黑色; } .leftp { 浮:左; 宽度:400 px; background - color: # CC6633; } .rightp { 浮:正确; 宽度:400 px; background - color: # CC66FF; } .centerp { 浮:左; 宽度:50 px; 边境:1 px冲黑; padding-bottom: 1600 px;/*关键*/margin-bottom: -1600 px;/*关键*/} & lt; !DOCTYPE html公众“-//W3C XHTML 1.0//DTD//EN"过渡;“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"比; & lt; html xmlns=癶ttp://www.w3.org/1999/xhtml"比; & lt; head> & lt;元http-equiv=癈ontent-Type"内容=皌ext/html;charset=gb2312"/比; & lt; title>竖线画法& lt;/title> & lt;链接https://www.yisu.com/zixun/href=" . ./css/demo.css " rel="样式表" type=" text/css "/> >头 <身体>
身体>