1. One-column layout—commonly used on the homepage of a website.
html:
1 <div class="top"></div> 2 <div class="main"></div> 3 <div class='foot'></div>
css:
body{ margin:0; padding: 0; } .top{ height: 80px; background-color: #f19b6a; } .main,.foot{ width: 800px; margin:0 auto; } .main{ height: 500px; background-color: #f1b8e4; } .foot{ height: 80px; background-color: #f1f1b8; }
Effect:
2. Two columns (fixed width), Adaptive layout
html:
1 <p class="main"> 2 <p class="left"></p> 3 <p class="right"></p> 4 </p>
css:
body{ margin:0; padding: 0; } .main{ width: 800px; margin: 0 auto; } .left,.right{ height: 600px; } .left{ width: 20%; float: left; background-color:#f19b6a; } .right{ width: 80%; float: right; background-color: #f1b8e4; }
Rendering:
1 <p class="main"> 2 <p class="left"></p> 3 <p class="middle"></p> 4 <p class="right"></p> 5 </p>css:
body{ margin:0; padding: 0; } .main{ width: 800px; margin: 0 auto; } .left,.right,.middle{ height: 600px; } .left{ width: 33.3%; float: left; background-color:#f19b6a; } .middle{ width: 33.3%; float: left; background-color:#f1f1b8; } .right{ width: 33.3%; float: right; background-color: #f1b8e4; }Rendering:
1 <p class="left"></p> 2 <p class="middle"> 3 区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的 新型应用模式。 所谓共识机制是区块链系统中实现不同节点之间建立信任、获取权益的数学算法[1] 。 2016年5月,货币区块链研究中心出版了国内第一本深入浅出介绍区块链的书籍《区块链:定义未来金融与经济新格局》。 其中介绍了区块链技术对未来金融与经济带来的影响。区块链(Blockchain)是比特币的一个重要概念,火币联合清华大学五道口金融学院互联网金融实验室、 新浪科技发布的《2014—2016全球比特币发展研究报告》提到区块链是比特币的底层技术和基础架构[2] 。 本质上是一个去中心化的数据库,同时作为比特币的底层技术。区块链是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一次比特币网络交易的信息, 用于验证其信息的有效性(防伪)和生成下一个区块。 4 </p> 5 <p class="right"></p>css:
body{ margin:0; padding: 0; } .left,.right,.middle{ height: 600px; } .left{ width: 200px; position:absolute; left: 0; top:0; background-color:#f19b6a; } .middle{ margin: 0 310px 0 210px; background-color:#f1f1b8; } .right{ width: 300px; position: absolute; right: 0; top:0; background-color: #f1b8e4; }Rendering:
1 <p class="top"> 2 <p class="header"></p> 3 </p> 4 <p class="main"> 5 <p class="left"></p> 6 <p class="right"> 7 <p class="sub_left"></p> 8 <p class="sub_right"></p> 9 </p> 10 </p> 11 <p class='foot'></p>css:
body{ margin:0; padding: 0; } .top{ height: 80px; background-color: #f19b6a; } .top .header{ width: 800px; height: 80px; margin: 0 auto; background-color: #e27386; } .main,.foot{ width: 800px; margin:0 auto; } .main{ height: 600px; background-color: #f1b8e4; } .foot{ height: 80px; background-color: #f1f1b8; } .main .left{ width: 200px; height: 600px; float: left; background-color: #dcff93; } .main .right{ width: 590px;/*600px没有粉红色缝隙*/ height: 600px; float:right; background-color: #b8f1cc; } .sub_left{ width: 200px; height: 600px; float: left; background-color: #f2debd; } .sub_right{ width: 380px;/*390px没有中间绿色缝隙*/ height: 600px; float: right; background-color: #c86f67; }Rendering:
The above is the detailed content of Summary of the use of common layouts in CSS. For more information, please follow other related articles on the PHP Chinese website!

Let’s run through a quick refresher. Image maps date all the way back to HTML 3.2, where, first, server-side maps and then client-side maps defined clickable regions over an image using map and area elements.

The State of Devs survey is now open to participation, and unlike previous surveys it covers everything except code: career, workplace, but also health, hobbies, and more.

CSS Grid is a powerful tool for creating complex, responsive web layouts. It simplifies design, improves accessibility, and offers more control than older methods.

Article discusses CSS Flexbox, a layout method for efficient alignment and distribution of space in responsive designs. It explains Flexbox usage, compares it with CSS Grid, and details browser support.

The article discusses techniques for creating responsive websites using CSS, including viewport meta tags, flexible grids, fluid media, media queries, and relative units. It also covers using CSS Grid and Flexbox together and recommends CSS framework

The article discusses the CSS box-sizing property, which controls how element dimensions are calculated. It explains values like content-box, border-box, and padding-box, and their impact on layout design and form alignment.

Article discusses creating animations using CSS, key properties, and combining with JavaScript. Main issue is browser compatibility.

Article discusses using CSS for 3D transformations, key properties, browser compatibility, and performance considerations for web projects.(Character count: 159)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)
