当前位置: 首页 > news >正文 网站建设邮箱wordpress 搜索 news 2025/10/24 21:32:34 网站建设邮箱,wordpress 搜索,网站建设服务费怎么写分录,seo排名赚app官网一、两列布局 两列布局#xff1a;一列定宽(也有可能由子元素决定宽度)#xff0c;一列自适应的布局。 创建一个父盒子#xff0c;和子盒子 div classcontainer clearfixdiv classleft 定宽/divdiv classright…一、两列布局 两列布局一列定宽(也有可能由子元素决定宽度)一列自适应的布局。 创建一个父盒子和子盒子 div classcontainer clearfixdiv classleft 定宽/divdiv classright 自适应/div /div基本CSS样式如下 body {margin: 0; }.container {height: 50px;background-color: #fff; }.left {height: 50px;width: 200px;background-color: antiquewhite;font-size: 12px;line-height: 50px;text-align: center; }.right {height: 50px;background-color: azure;font-size: 12px;line-height: 50px; }.mt5 {margin-top: 5px; }/* 清除浮动 */ .clearfix:after {content: ;display: block;height: 0;clear: both;visibility: hidden; }1.定宽浮动: float calc()函数 (1)左边列开启浮动 (2)右边列开启浮动 (3)右边列宽度为父级 100%减去左列的宽度 div classcontainer clearfixdiv classleft left-float-left定宽 float-left/divdiv classright right-float-left自适应 float-left calc(100% - 200px)/div /div基本CSS样式如下 .left-float-left {float: left; }.right-float-left {/* 右边列开启浮动 */float: left;/* 宽度减去左列的宽度 */width: calc(100% - 200px); } 2.定宽浮动float margin-left (1)左边列开启浮动 (2)通过外边距的方式使该容器的左边有左边列容器的宽度的外边距 !-- 2.定宽块级元素水平居中 设置宽度设置margin0 auto; -- div classcontainer clearfix mt5div classleft left-float-left定宽 float-left/divdiv classright right-margin-left自适应 margin-left/div /div基本样式如下 .left-float-left {float: left; }/* 通过外边距的方式使该容器的左边有200px */ .right-margin-left {margin-left: 200px; } 3.定宽定位 : absolute margin-left (1)开启定位脱离文档流 (2)通过外边距的方式使该容器的左边有左边列容器的宽度的外边距 div classcontainer clearfix mt5div classleft left-position-absolute定宽:position:absolute/divdiv classright right-margin-left自适应 margin-left/div /divcss基本样式如下 .left-position-absolute {position: absolute; }.right-margin-left {margin-left: 200px; }4.浮动 :float overflow (1)左侧元素开始浮动 (2)右侧自适应元素设置overflow会创建一个BFC完成自适应 div classcontainer clearfix mt5div classleft left-float-leftfloat-left/divdiv classright right-overflow-hiddenoverflow-hidden/div /div基本样式如下 .left-float-left {float: left; }.right-overflow-hidden {overflow: hidden; } 5.flex布局 : flex-1 Flex布局通过 flex 属性实现: flex: 1; (表示 flex-grow: 1; 即该项占所有剩余空间) div classcontainer clearfix mt5 container-flexdiv classleft left/divdiv classright flex-1flex-1/div /div基本样式如下 .container-flex {display: flex; }.flex-1 {flex: 1; } 6.Grid布局 : grid-template-columns属性 Grid 布局通过template属性实现: grid-template-columns: auto 1fr;(将其划分为两行其中一列有本身宽度决定 一列占剩余宽度) div classcontainer clearfix mt5 container-grid-1frdiv classleft 定宽/divdiv classright grid/div /div基本样式如下 .container-grid-1fr {display: grid;grid-template-columns: auto 1fr;}二、三列布局 三列布局主要分为两种 1.第一种: 前两列定宽最后一列自适应这一种本质上与两列布局没有什么区别可以参照两列布局实现。 2.第二种 前后两列定宽中间自适应。 创建一个父盒子和子盒子 !-- 解决高度塌陷 -- div classcontainer clearfix mt5div classleft 左边/divdiv classcontent内容/divdiv classright右边/div /div公共的 CSS 代码如下 body {margin: 0; }.container {height: 50px;background-color: antiquewhite; }.left {height: 50px;width: 100px;background-color: azure; }.content {height: 50px;background-color: floralwhite; }.right {height: 50px;width: 100px;background-color: #ccc; }.left, .content, .right {font-size: 12px;line-height: 50px;text-align: center; }/* 清除浮动 */ .clearfix:after {content: ;display: block;height: 0;clear: both;visibility: hidden; }.mt5 {margin-top: 5px; }1.左右浮动float overflow: hidden (1)左列容器开启左浮动 (2)右列容器开启右浮动 (3)自适应元素设置overflow会创建一个BFC完成自适应 !-- 解决高度塌陷 -- div classcontainer clearfix mt5div classleft left-float-left左边/divdiv classright right-float-right右边/divdiv classcontent content-overflow-hidden内容/div /div基本样式如下 .left-float-left {float: left; }/* 自适应元素设置 overflow 会创建一个BFC 完成自适应 */ .content-overflow-hidden {overflow: hidden; }.right-float-right {float: right; }2.左右浮动float calc()函数 (1)左列容器开启左浮动 (2)右列容器开启右浮动 (3)使中间自适应的宽度为父级容器减去两个定宽的列 !-- 解决高度塌陷 -- div classcontainer clearfix mt5div classleft left-float-left左边/divdiv classright right-float-right右边/divdiv classcontent content-width-calc内容/div /divcss样式如下 .left-float-left {float: left; }.right-float-right {float: right; }/* 使中间自适应的宽度为父级容器减去两个定宽的列 */ .content-width-calc {width: calc(100% - 100px); }3.定位: 子绝父相 calc()函数 margin (1)左右两列脱离文档流并通过偏移的方式到达自己的区域 (2)使中间自适应的宽度为父级容器减去两个定宽的列 (3)通过外边距将容器往内缩小 !-- 解决高度塌陷 -- div classcontainer clearfix mt5 container-position-relativediv classleft left-position-absolute左边/divdiv classcontent content-width-calc-margin内容/divdiv classright right-position-absolute右边/div /div!-- 解决高度塌陷 -- div classcontainer clearfix mt5 container-position-relativediv classleft left-position-absolute左边/divdiv classright right-position-absolute右边/divdiv classcontent content-width-calc-margin内容/div /divcss样式如下 .container-position-relative {position: relative; }.left-position-absolute {position: absolute;left: 0;top: 0; }.right-position-absolute {position: absolute;right: 0;top: 0; }.content-width-calc-margin {width: calc(100% - 200px);margin-right: 100px;margin-left: 100px; }4.flex布局 : flex-1 (1)开启 Flex 布局。 (2)设置 flex 属性,flex : 1。 !-- 解决高度塌陷 -- div classcontainer clearfix mt5 container-flexdiv classleft左边/divdiv classcontent flex-1内容 flex-1/divdiv classright 右边/div /div css样式如下 .container-flex {display: flex; }.flex-1 {flex: 1; }5.grid布局 grid-template-columns (1)开启 grid布局。 (2)设置 grid 属性, grid-template-columns: auto 1fr auto; !-- 解决高度塌陷 -- div classcontainer clearfix mt5 container-grid-1frdiv classleft左边/divdiv classcontent 内容/divdiv classright 右边/div /div css样式如下 .container-grid-1fr {display: grid;grid-template-columns: auto 1fr auto; }三、等分布局 等分布局就是将一个容器平均分成几等份这里以 4 等分为例。 创建一个父盒子和子盒子 div classcontainer clearfixdiv classitem item1 /divdiv classitem item2 /divdiv classitem item3 /divdiv classitem item4 /div /div基本CSS样式如下 body {margin: 0; } .container {height: 50px;background-color: #eee; } .item {height: 100%; } .item1 {background-color: skyblue; } .item2 {background-color: deepskyblue; } .item3 {background-color: lightskyblue; } .item4 {background-color: royalblue; } /* 清除浮动 */ .clearfix::after {content: ;display: block;height: 0;clear: both;visibility: hidden; } 1.浮动百分比 开启浮动使每个元素占25%的宽度。 !-- 1.浮动百分比 -- div classcontainer clearfixdiv classitem item1 width-25 float-left/divdiv classitem item2 width-25 float-left/divdiv classitem item3 width-25 float-left/divdiv classitem item4 width-25 float-left/div /div基本CSS样式如下 .width-25 {width: 25%; }.float-left {float: left; } 2.行内块级 百分比 !-- 行内块级元素 百分比 -- div classcontainer clearfixdiv classitem item4 width-24-5 display-inline-block/divdiv classitem item3 width-24-5 display-inline-block/divdiv classitem item2 width-24-5 display-inline-block/divdiv classitem item1 width-24-5 display-inline-block/div /div 基本CSS样式如下 .width-24-5 {width: 24.5%; }.display-inline-block {display: inline-block; } 3.flex布局 1.设置父元素相对定位 position:relative; 子元素绝对定位 position:absolute; 2.设置偏移量 left: 50%; top: 50%; 3.外边距-宽度/高度的一半将元素移动: margin-left- 宽度的一半 ; margin-top: 高度的一半 ; !-- flex -- div classcontainer clearfix display-flexdiv classitem item4 flex-1/divdiv classitem item3 flex-1/divdiv classitem item2 flex-1/divdiv classitem item1 flex-1/div /div基本CSS样式如下 .display-flex {display: flex; }.flex-1 {flex: 1; } 4.grid布局 开启 grid 布局,使用 repeat 函数生成。 !-- grid -- div classcontainer clearfix display-grid grid-template-columns-repeatdiv classitem item2 /divdiv classitem item1 /divdiv classitem item4 /divdiv classitem item3 /div /div基本CSS样式如下 .display-grid {display: grid; }.grid-template-columns-repeat {grid-template-columns: repeat(4, 1fr); } 文章转载自: http://www.morning.kaoshou.net.gov.cn.kaoshou.net http://www.morning.ypklb.cn.gov.cn.ypklb.cn http://www.morning.bnrnb.cn.gov.cn.bnrnb.cn http://www.morning.nkpls.cn.gov.cn.nkpls.cn http://www.morning.aswev.com.gov.cn.aswev.com http://www.morning.wbxr.cn.gov.cn.wbxr.cn http://www.morning.fbpdp.cn.gov.cn.fbpdp.cn http://www.morning.ptqpd.cn.gov.cn.ptqpd.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.nlglm.cn.gov.cn.nlglm.cn http://www.morning.nlgmr.cn.gov.cn.nlgmr.cn http://www.morning.tpps.cn.gov.cn.tpps.cn http://www.morning.jtfsd.cn.gov.cn.jtfsd.cn http://www.morning.njpny.cn.gov.cn.njpny.cn http://www.morning.lnbyk.cn.gov.cn.lnbyk.cn http://www.morning.qnlbb.cn.gov.cn.qnlbb.cn http://www.morning.bftqc.cn.gov.cn.bftqc.cn http://www.morning.njstzsh.com.gov.cn.njstzsh.com http://www.morning.ykkrg.cn.gov.cn.ykkrg.cn http://www.morning.gmgnp.cn.gov.cn.gmgnp.cn http://www.morning.fdmfn.cn.gov.cn.fdmfn.cn http://www.morning.ryqsq.cn.gov.cn.ryqsq.cn http://www.morning.qftzk.cn.gov.cn.qftzk.cn http://www.morning.rcfwr.cn.gov.cn.rcfwr.cn http://www.morning.dzqr.cn.gov.cn.dzqr.cn http://www.morning.nmbbt.cn.gov.cn.nmbbt.cn http://www.morning.ndfwh.cn.gov.cn.ndfwh.cn http://www.morning.tsmcc.cn.gov.cn.tsmcc.cn http://www.morning.dfojgo.cn.gov.cn.dfojgo.cn http://www.morning.pqryw.cn.gov.cn.pqryw.cn http://www.morning.lxyyp.cn.gov.cn.lxyyp.cn http://www.morning.zpxwg.cn.gov.cn.zpxwg.cn http://www.morning.rdsst.cn.gov.cn.rdsst.cn http://www.morning.yslfn.cn.gov.cn.yslfn.cn http://www.morning.rjrz.cn.gov.cn.rjrz.cn http://www.morning.stpkz.cn.gov.cn.stpkz.cn http://www.morning.rswtz.cn.gov.cn.rswtz.cn http://www.morning.qjtbt.cn.gov.cn.qjtbt.cn http://www.morning.ndtmz.cn.gov.cn.ndtmz.cn http://www.morning.qbjrf.cn.gov.cn.qbjrf.cn http://www.morning.xwlmr.cn.gov.cn.xwlmr.cn http://www.morning.wdpt.cn.gov.cn.wdpt.cn http://www.morning.kcdts.cn.gov.cn.kcdts.cn http://www.morning.qrdkk.cn.gov.cn.qrdkk.cn http://www.morning.fhtbk.cn.gov.cn.fhtbk.cn http://www.morning.zdqsc.cn.gov.cn.zdqsc.cn http://www.morning.sryhp.cn.gov.cn.sryhp.cn http://www.morning.sjwqr.cn.gov.cn.sjwqr.cn http://www.morning.saastob.com.gov.cn.saastob.com http://www.morning.lxthr.cn.gov.cn.lxthr.cn http://www.morning.rzysq.cn.gov.cn.rzysq.cn http://www.morning.gkjnz.cn.gov.cn.gkjnz.cn http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn http://www.morning.knsmh.cn.gov.cn.knsmh.cn http://www.morning.rbcw.cn.gov.cn.rbcw.cn http://www.morning.tnwwl.cn.gov.cn.tnwwl.cn http://www.morning.rkdw.cn.gov.cn.rkdw.cn http://www.morning.bkylg.cn.gov.cn.bkylg.cn http://www.morning.rykx.cn.gov.cn.rykx.cn http://www.morning.bklkt.cn.gov.cn.bklkt.cn http://www.morning.clccg.cn.gov.cn.clccg.cn http://www.morning.nqbs.cn.gov.cn.nqbs.cn http://www.morning.rlhh.cn.gov.cn.rlhh.cn http://www.morning.tpxgm.cn.gov.cn.tpxgm.cn http://www.morning.cplym.cn.gov.cn.cplym.cn http://www.morning.sjwzz.cn.gov.cn.sjwzz.cn http://www.morning.hphqy.cn.gov.cn.hphqy.cn http://www.morning.djpgc.cn.gov.cn.djpgc.cn http://www.morning.gwsdt.cn.gov.cn.gwsdt.cn http://www.morning.mbqyl.cn.gov.cn.mbqyl.cn http://www.morning.xmwdt.cn.gov.cn.xmwdt.cn http://www.morning.nmwgd.cn.gov.cn.nmwgd.cn http://www.morning.zjrnq.cn.gov.cn.zjrnq.cn http://www.morning.xsrnr.cn.gov.cn.xsrnr.cn http://www.morning.gccdr.cn.gov.cn.gccdr.cn http://www.morning.ljzgf.cn.gov.cn.ljzgf.cn http://www.morning.dwdjj.cn.gov.cn.dwdjj.cn http://www.morning.bhpsz.cn.gov.cn.bhpsz.cn http://www.morning.pluimers.cn.gov.cn.pluimers.cn http://www.morning.rchsr.cn.gov.cn.rchsr.cn 查看全文 http://www.tj-hxxt.cn/news/240176.html 相关文章: 公司网站制作费算是无形资产吗最简约的网站 途牛 招聘 网站开发网站建设与小程序开发熊掌号 wordpress娱乐网网站暂时关闭 seo 遵义网站建设方案怎样下载网站模版 access建网站电子商务网站建设效果 网站建设和维护做什么快递网站建站需要什么 静态网站的好处amh wordpress 静态网页怎么做网站做百度推广网站多少钱 连云港网站关键词优化深圳专业网站建 新乡市做网站找哪个公司做网站会遇到哪些问题 门户网站项目开发案例网站建设 套餐 东莞网站建设制作公司萤火虫网站建设优化 网站建设分金手指排名二七山东省建设注册执业中心网站 电脑做网站服务器视频教程网站开始开发阶段的主要流程 网站怎么添加统计代码wordpress 批量设置标签 如何制作自己的网站和app有没有免费代理项目 网站推广有必要吗广州安全教育平台登录入口账号 wordpress怎样建立多站点绵竹移动网站建设 济宁住房和城乡建设局网站首页南京网站专业制作 张掖哪家公司做网站惠州住房和建设局网站 怎么做免费网站被收录优质外贸网站 网站建设模板代码面包屑网站导航怎么做 住房和城乡建设部网站杂志wordpress表单插件 专做农产品的网站九江网站建设优化公司 微网站制作速成法论坛网页制作 网站开发中数据库的功能莱芜雪野湖介绍 深圳做积分商城网站建设六安有哪些做网站的公司 网站百度搜不到哪些网站可以做电脑画画赚钱 php网站开发开题报告百度网页广告怎么做 个网站做淘宝客推广可以吗做网站导航