欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

html中如何實現(xiàn)兩欄布局

這篇文章給大家分享的是有關html中如何實現(xiàn)兩欄布局的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)是一家業(yè)務范圍包括IDC托管業(yè)務,虛擬空間、主機租用、主機托管,四川、重慶、廣東電信服務器租用,綿陽機房托管,成都網通服務器托管,成都服務器租用,業(yè)務范圍遍及中國大陸、港澳臺以及歐美等多個國家及地區(qū)的互聯(lián)網數據服務公司。

html中實現(xiàn)兩欄布局的方法:1、利用float屬性和margin屬性來實現(xiàn);2、利用BFC技術來實現(xiàn);3、利用table布局技術來實現(xiàn);4、利用flex彈性布局技術來實現(xiàn);5、利用grid網格布局技術來實現(xiàn)。

本教程操作環(huán)境:windows7系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。

html網頁中實現(xiàn)兩欄布局

1、利用float+margin實現(xiàn)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.left1 {
height: 300px;
background-color: red;
width: 400px;
float: left;
}

.right1 {
width: 400px;
height: 300px;
background-color: green;
margin-left: 400px;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html>

2、利用BFC實現(xiàn)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.left2 {
height: 300px;
background-color: red;
width: 400px;
float: left;
}

.right2 {
height: 300px;
background-color: blue;
overflow: hidden;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html>

3、利用table布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.parent {
display: table;
width: 100%;
table-layout: fixed;
}

.left3 {
display: table-cell;
height: 300px;
width: 300px;
background-color: pink;
}

.right3 {
display: table-cell;
height: 300px;
background-color: purple;
}
</style>
</head>
<body>
<div>
<div></div>
<div></div>
</div>
</body>
</html>

4、利用flex布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.parentf {
display: flex;
flex-direction: row;
justify-content: flex-start;
width: 100%;
}

.left4 {
height: 300px;
width: 300px;
background-color: skyblue;
}

.right4 {
height: 300px;
width: 100%;
background-color: yellowgreen;
}
</style>
</head>
<body>
<div>
<div></div>
<div></div>
</div>
</body>
</html>

5、利用grid布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.parent {
height: 400px;
display: grid;
grid-template-columns: 50% 50%;
width: 100%;
}

.left5 {
background-color: skyblue;
}

.right5 {
background-color: pink;
}
</style>
</head>
<body>
<div>
<div></div>
<div></div>
</div>
</body>
</html>

感謝各位的閱讀!關于“html中如何實現(xiàn)兩欄布局”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

網頁名稱:html中如何實現(xiàn)兩欄布局
鏈接URL:http://www.chinadenli.net/article6/jdjpog.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供標簽優(yōu)化服務器托管搜索引擎優(yōu)化自適應網站網站維護品牌網站設計

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化