2022年11月23日14:23:00—H5—T7-T8(布局与内容填充)
H5 2022 内容 11 布局 14 23 填充
2023-09-14 09:14:16 时间
Base.css
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
ul {
list-style: none;
}
.col-1 {
width: 8.33%;
float: left;
}
.col-2 {
width: 16.66%;
float: left;
}
.col-3 {
width: 25%;
float: left;
}
.col-4 {
width: 33.33%;
float: left;
}
.col-5 {
width: 41.66%;
float: left;
}
.col-6 {
width: 50%;
float: left;
}
.col-7 {
width: 58.33%;
float: left;
}
.col-8 {
width: 66.66%;
float: left;
}
.col-9 {
width: 75%;
float: left;
}
.col-10 {
width: 83.33%;
float: left;
}
.col-11 {
width: 91.66%;
float: left;
}
.col-12 {
width: 100%;
float: left;
}
示例:基本框架的创建
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/base.css">
</head>
<body>
<!-- 开始填充文字 -->
<div id="top" class="col-12" style="background-color: #3C3E3B;height: 10vh;">
<style>
.top_left_text {
text-align: center;
line-height: 10vh;
font-size: 1.2rem;
font-weight: bolder;
}
</style>
<div class="col-2 top_left_text" style="background-color: pink;height: 10vh;">
<span>游戏商城</span>
</div>
<div class="col-7" style="background-color: skyblue;height: 10vh;">
<style>
.top_center_ul {
width: 100%;
}
.top_center_ul li {
width: 25%;
float: left;
text-align: center;
line-height: 10vh;
}
.top_center_ul li:hover {
background-color: black;
color: white;
cursor: pointer;
}
</style>
<ul class="top_center_ul">
<li>商店</li>
<li>关于</li>
<li>社区</li>
<li>支持</li>
</ul>
</div>
<div class="col-3" style="background-color: red;height: 10vh;">
<style>
.top_right_ul {
background-color: black;
height: 8vh;
border-radius: 0px 0px 30% 30%;
}
.top_right_ul li {
width: 33.33%;
line-height: 8vh;
color: white;
float: left;
text-align: center;
}
.top_right_ul li:hover {
background-color: gray;
}
</style>
<ul class="top_right_ul" style="width: 100%;">
<li>登录</li>
<li>注册</li>
<li>搜索</li>
</ul>
</div>
</div>
<div class="col-12" style="height: 5vh;">
<div class="col-1" style="height: 5vh;"></div>
<div class="col-10" style="height: 5vh;">新鲜事情</div>
<div class="col-1" style="height: 5vh;"></div>
</div>
<div class="col-12" style="height: 50vh;">
<div class="col-1" style="height: 50vh;"></div>
<style>
.banner-img {
height: 50vh;
background-color: skyblue;
border-radius: 12px;
box-shadow: 5px 5px 5px 5px gray;
}
</style>
<div class="col-10 banner-img"></div>
<div class="col-1" style="height: 50vh;"></div>
</div>
</body>
</html>
内容填充,完成效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/base.css">
</head>
<body>
<!-- top完毕 -->
<div class="col-12" style="height: 10vh;background-color: #3D3E3B;">
<style>
.top_left_text {
text-align: center;
font-size: 1.5rem;
font-weight: bolder;
color: white;
line-height: 10vh;
}
</style>
<div class="col-2 top_left_text" style="height: 10vh;">
游戏商城
</div>
<div class="col-7" style="height: 10vh;">
<style>
.top_center_ul {
width: 100%;
}
.top_center_ul li {
width: 25%;
float: left;
text-align: center;
line-height: 10vh;
color: white;
cursor: pointer;
/* 鼠标变手 */
}
</style>
<ul class="top_center_ul">
<li>宫廷玉叶酒</li>
<li>霸王别鸡</li>
<li>干锅咕咾肉</li>
<li>佛跳跳</li>
</ul>
</div>
<div class="col-3" style="height: 10vh;">
<style>
.top_right_ul {
width: 100%;
background-color: black;
height: 5vh;
border-radius: 0px 0px 100px 100px;
}
.top_right_ul li {
width: 33.33%;
float: left;
text-align: center;
color: white;
cursor: pointer;
}
</style>
<ul class="top_right_ul">
<li>登录</li>
<li>注册</li>
<li>搜索</li>
</ul>
</div>
</div>
<!-- banner_text -->
<div class="col-12">
<div class="col-2" style="height: 5vh;"></div>
<div class="col-7" style="height: 5vh;">新鲜事</div>
<div class="col-3" style="height: 5vh;"></div>
</div>
<!-- banner_2 -->
<div class="col-12">
<div class="col-2" style="height: 50vh;"></div>
<style>
.banner_2_img {
height: 50vh;
background-image: url('imgs/bg.jpg');
background-size: 100% 100%;
}
.banner_2_img_button {
position: relative;
left: 85%;
top: 85%;
}
</style>
<div class="col-8 banner_2_img">
<button class="banner_2_img_button">¥699.99元</button>
</div>
<div class="col-2" style="height: 50vh;"></div>
</div>
</body>
</html>
这里每个盒子都要处理好对应的高度比例。
相关文章
- H5移动端知识点总结
- 首次写iPad布局感想(H5)
- H5使用Canvas绘图
- h5页面在ios机上禁止长按复制
- H5+JS+CSS3 综合应用
- H5页面快速搭建之高级字体应用实践
- H5新特性之webWorker
- 亲历H5移动端游戏微信支付接入及那些坑(三)——支付接入
- H5及微信中唤起app的解决方案
- H5单页面架构:backbone + requirejs + zepto + underscore
- 一种流量成本节省60%以上的手机直播微信直播H5直播幼儿园直播方案
- web无插件播放RTSP摄像机方案,拒绝插件,拥抱H5!
- Atitit .h5文件上传 v3
- [h5棋牌项目]-15-C#与C++通信
- HTML5响应式网页设计——核心技能考核示例(用于2022年11月H5考核)