Summary of the use of common layouts in CSS
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>
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; }
1 <p class="left"></p> 2 <p class="middle"> 3 区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的 新型应用模式。 所谓共识机制是区块链系统中实现不同节点之间建立信任、获取权益的数学算法[1] 。 2016年5月,货币区块链研究中心出版了国内第一本深入浅出介绍区块链的书籍《区块链:定义未来金融与经济新格局》。 其中介绍了区块链技术对未来金融与经济带来的影响。区块链(Blockchain)是比特币的一个重要概念,火币联合清华大学五道口金融学院互联网金融实验室、 新浪科技发布的《2014—2016全球比特币发展研究报告》提到区块链是比特币的底层技术和基础架构[2] 。 本质上是一个去中心化的数据库,同时作为比特币的底层技术。区块链是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一次比特币网络交易的信息, 用于验证其信息的有效性(防伪)和生成下一个区块。 4 </p> 5 <p class="right"></p>
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; }
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>
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; }
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!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics











Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text
