【1】float + margin + calc
创新互联建站是一家以网络技术公司,为中小企业提供网站维护、网站建设、成都网站制作、网站备案、服务器租用、域名申请、软件开发、小程序设计等企业互联网相关业务,是一家有着丰富的互联网运营推广经验的科技公司,有着多年的网站建站经验,致力于帮助中小企业在互联网让打出自已的品牌和口碑,让企业在互联网上打开一个面向全国乃至全球的业务窗口:建站服务热线:18980820575<style>p{margin: 0;}.parent{overflow: hidden;}.left,.right{float: left;width: 100px;}.center{float: left; width:calc(100% - 240px);margin: 0 20px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> </div> </div>
【2】float + margin + (fix)
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.right{position: relative;float: left;width: 100px;}.centerWrap{float: left; width:100%; margin: 0 -100px;}.center{margin: 0 120px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="centerWrap" > <div class="center" > <p>center</p> <p>center</p> </div> </div> <div class="right" > <p>right</p> </div> </div>
【1】inline-block + margin + calc
<style>p{margin: 0;}.parent{font-size: 0;}.left,.right,.center{display:inline-block; vertical-align: top;font-size: 16px;}.left,.right{width: 100px;}.center{width: calc(100% - 240px); margin: 0 20px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> </div> </div>
【2】inline-block + margin + (fix)
<style>p{margin: 0;}.parent{font-size: 0;}.left,.right,.centerWrap{display:inline-block; vertical-align: top;font-size: 16px;}.left,.right{width: 100px;position:relative;}.centerWrap{width: 100%; margin: 0 -100px;}.center{margin: 0 120px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="centerWrap" > <div class="center" > <p>center</p> <p>center</p> </div> </div> <div class="right" > <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: table; width: 100%;table-layout: fixed;}.left,.right,.centerWrap{display:table-cell;}.left,.right{width: 100px;}.center{margin: 0 20px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="centerWrap" > <div class="center" > <p>center</p> <p>center</p> </div> </div> <div class="right" > <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{position: relative;height:40px;}.left,.right,.center{position: absolute;}.left{left: 0;width:100px;}.right{right: 0;width: 100px;}.center{left: 120px; right: 120px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: flex;}.left,.right{width: 100px;}.center{flex: 1; margin: 0 20px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> </div> </div>
这种布局与单列定宽单列自适应布局非常相似
【1】float + margin
缺点是IE6-浏览器的3px的bug,以及当自适应列中有元素清除浮动时,会使该元素不与左侧浮动元素同行,从而出现文字下沉现象
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.center{float: left;width: 100px;margin-right: 20px;}.right{margin-left: 240px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
【2】float + margin + calc
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.center{float: left;width: 100px;margin-right: 20px;}.right{float: left; width: calc(100% - 240px);}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
【3】float + margin + (fix)
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.center{position: relative; float: left;width: 100px;margin-right: 20px;}.rightWrap{float: left; width: 100%; margin-left: -240px;}.right{margin-left:240px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="rightWrap"> <div class="right" > <p>right</p> <p>right</p> </div> </div> </div>
【4】float + overflow
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.center{position: relative; float: left;width: 100px;margin-right: 20px;}.right{overflow: hidden;zoom:1;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
【1】inline-block + margin + calc
<style>p{margin: 0;}.parent{font-size: 0;}.left,.right,.center{display:inline-block; vertical-align: top;font-size: 16px;}.left,.center{width: 100px;margin-right:20px;}.right{width: calc(100% - 240px);}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
【2】inline-block + margin + (fix)
<style>p{margin: 0;}.parent{font-size: 0;}.left,.rightWrap,.center{display:inline-block; vertical-align: top;font-size: 16px;}.left,.center{position: relative;width: 100px;margin-right:20px;}.rightWrap{width:100%; margin-left: -240px;}.right{margin-left: 240px;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="rightWrap" > <div class="right" > <p>right</p> <p>right</p> </div> </div> </div>
<style>p{margin: 0;}.parent{display: table; width: 100%;table-layout: fixed;}.leftWrap,.centerWrap,.right{display:table-cell;}.leftWrap,.centerWrap{width: 120px;}.left,.center{margin-right: 20px;}</style>
<div class="parent" > <div class="leftWrap"> <div class="left" > <p>left</p> </div> </div> <div class="centerWrap"> <div class="center" > <p>center</p> </div> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{position: relative;width:100%;height:40px;}.left{position: absolute;left:0;width:100px;}.center{position: absolute;left:120px;width: 100px;}.right{position: absolute;left:240px; right:0;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: flex;}.left,.center{width:100px;margin-right:20px;}.right{flex:1;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{overflow: hidden;}.left{float: left;margin-right: 20px;}.center{float: left;width: 100px;margin-right: 20px;}.right{overflow: hidden;}</style>
<div class="parent" > <div class="left" > <p>left</p> <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: table; width: 100%;}.leftWrap{display: table-cell; width: 0.1%;}.centerWrap{display: table-cell;width: 120px;}.left,.center{margin-right: 20px;}.right{display:table-cell;}</style>
<div class="parent" > <div class="leftWrap"> <div class="left" > <p>left</p> <p>left</p> </div> </div> <div class="centerWrap"> <div class="center" > <p>center</p> </div> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: flex;}.left{margin-right: 20px;}.center{width: 100px;margin-right: 20px;}.right{flex: 1;}</style>
<div class="parent" > <div class="left" > <p>left</p> <p>left</p> </div> <div class="center" > <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{overflow: hidden;}.left{float: left;width: 100px;margin-right: 20px;}.center{float: left;margin-right: 20px;}.right{overflow: hidden;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: table; width: 100%;}.leftWrap{display: table-cell; width: 120px;}.centerWrap{display: table-cell;width: 0.1%;}.left,.center{margin-right: 20px;}.right{display:table-cell;}</style>
<div class="parent" > <div class="leftWrap"> <div class="left" > <p>left</p> </div> </div> <div class="centerWrap"> <div class="center" > <p>center</p> <p>center</p> </div> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: flex;}.left{width: 100px;margin-right: 20px;}.center{margin-right: 20px;}.right{flex: 1;}</style>
<div class="parent" > <div class="left" > <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{overflow: hidden;}.left,.center{float: left;margin-right: 20px;}.right{overflow: hidden;}</style>
<div class="parent" > <div class="left" > <p>left</p> <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: table; width: 100%;}.leftWrap,.centerWrap{display: table-cell;width: 0.1%;}.left,.center{margin-right: 20px;}.right{display:table-cell;}</style>
<div class="parent" > <div class="leftWrap"> <div class="left" > <p>left</p> <p>left</p> </div> </div> <div class="centerWrap"> <div class="center" > <p>center</p> <p>center</p> </div> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
<style>p{margin: 0;}.parent{display: flex;}.left,.center{margin-right: 20px;}.right{flex: 1;}</style>
<div class="parent" > <div class="left" > <p>left</p> <p>left</p> </div> <div class="center" > <p>center</p> <p>center</p> </div> <div class="right" > <p>right</p> <p>right</p> </div> </div>
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站名称:CSS三列布局-创新互联
浏览地址:https://www.cdcxhl.com/article4/ehpie.html
成都网站建设公司_创新互联,为您提供品牌网站建设、App开发、网站设计公司、品牌网站制作、手机网站建设、品牌网站设计
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联