格子布局

本文介绍了一个使用HTML和CSS实现的复杂格子布局案例。通过不同的布局技巧,将页面划分为多个区域,每个区域都有特定的颜色和尺寸。文章展示了如何利用浮动、定位等属性来创建一个清晰且美观的网页布局。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>格子布局</title>

<style>

.father{

border: 10px solid white;

width: 500px;

height: 600px;

float:left;

font-size: 40px;

text-align: center;

line-height: 100px;

}

.top div{

width: 100px;

height: 100px;

background-color: #00801F;

float:left;

}

.center_left{

float:left;

}

.left_top{

width: 300px;

height: 100px;

background-color: #FFFD4B;

}

.c_left{

width: 150px;

height: 150px;

float:left;

background-color: #7F8081;

}

.c_right{

width: 150px;

height: 150px;

float:right;

background-color: black;

color:white;

}

.left_bottom{

width: 300px;

height: 100px;

background-color:red;

float:left;

}

.center_right{

float: right;

}

.right_top{

width: 200px;

height: 200px;

background-color: #00D5D9;

}

.right_bottom{

width: 200px;

height: 150px;

background-color: #00FFFE;

}

.bottom{

width: 500px;

height: 150px;

background-color: #0026F7;

float:left;

}


</style>

</head>

<body>

<div class="father">

<div class="top">

<div>1</div>

<div>2</div>

<div>3</div>

<div>4</div>

<div>5</div>

</div>

<div class="center">

<div class="center_left">

<div class="left_top">6</div>

<div class="left_center">

<div class="c_left">8</div>

<div class="c_right">9</div>

</div>

<div class="left_bottom">11</div>

</div>

<div class="center_right">

<div class="right_top">7</div>

<div class="right_bottom">10</div>

</div>

</div>

<div class="bottom">12</div>


</div>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值