当前位置: 首页 > news >正文

14.1.2-float浮动练习

文章目录

  • 1. 目标
  • 2. 实现

1. 目标

只通过float来做下面的布局(不使用flex)。

2. 实现

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>float4-浮动练习.html</title><!-- 引入normalize.css,可以清除body的外边距,这样100vh就不会有滚动条了。 --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"><style>.page {/* border: 1px solid black; */height: 100vh;width: 960px;/* background-color: antiquewhite; */margin: 0 auto;}.header {width: 100%;height: 80px;background-color: aquamarine;margin: 0 0px 10px 0;line-height: 80px;text-align: center;}.header .logo {width: 200px;height: 80px;background-color: lightgreen;float: left;}.header .banner1 {width: 540px;height: 80px;background-color: lightgreen;float: left;margin: 0 10px;}.header .banner2 {width: 200px;height: 80px;background-color: lightgreen;float: left;}.menu {width: 100%;height: 30px;background-color: lightgreen;line-height: 30px;text-align: center;margin-bottom: 10px;}.main {width: 100%;height: 410px;background-color: azure;}.main .main-left {width: 750px;height: 410px;float: left;background-color: lightgreen;}.main .main-right {width: 200px;height: 410px;float: right;background-color: lightgreen;}.item7,.item8,.item9 {width: 200px;height: 130px;background-color: rgb(247, 137, 137);text-align: center;line-height: 130px;}.item8 {margin: 10px 0;}/* 栏目1和栏目2 */.main-left-up {width: 100%;height: 200px;background-color: aquamarine;margin-bottom: 10px;}.item1,.item2 {width: 370px;height: 100%;display: inline-block;background-color: aqua;text-align: center;line-height: 200px;}.item1 {float: left;}.item2 {float: right;}/* 栏目3、4、5、6 */.main-left-down {width: 100%;height: 200px;background-color: aquamarine;}.item3,.item4,.item5,.item6 {width: 180px;height: 200px;display: inline-block;background-color: rgb(0, 191, 255);text-align: center;line-height: 200px;}.item3,.item4 {float: left;}.item6 {float: right;}.item5 {float: right;}.item3,.item5 {margin-right: 10px;}.footer {width: 100%;height: 60px;background-color: lightgreen;line-height: 60px;text-align: center;margin-top: 10px;}</style>
</head><body><div class="page"><!-- header通栏 --><div class='header'><div class="logo">logo</div><div class="banner1">banner1</div><div class="banner2">banner2</div></div><!-- menu通栏 --><div class='menu'>菜单</div><!-- main主体,分成左右2部分 --><div class="main"><div class='main-left'><!-- 栏目一和栏目二 --><div class="main-left-up"><div class="item1">栏目1</div><div class="item2">栏目2</div></div><div class="main-left-down"><div class="item3">栏目3</div><div class="item4">栏目4</div><div class="item6">栏目6</div><div class="item5">栏目5</div></div></div><div class='main-right'><div class="item7">栏目7</div><div class="item8">栏目8</div><div class="item9">栏目9</div></div></div><!-- footer页脚 --><div class='footer'>页脚</div></div></body></html>

http://www.mrgr.cn/news/31633.html

相关文章:

  • 如何着手创建企业数据目录?(三)权限管理及版本控制
  • Spring Boot在高校心理教育辅导系统中的应用
  • 科研绘图系列:R语言箱线图和连线图(boxplot linechart)
  • 详解ChatBI Agent架构:打造高效数据统计系统
  • mysql批量修改表前缀
  • uniapp 微信小程序 订阅消息功能实现
  • 计算机组成原理之计算机软件和硬件的关系
  • LabVIEW编程能力如何能突飞猛进
  • vue3 本地windows下的字体的引用
  • 新峰商城之购物车(三)
  • 自然语言常见面试题及答案(116~120)
  • 会声会影2025视频剪辑教学
  • Go语言的垃圾回收(GC)机制的迭代和优化历史
  • 【Linux基础IO】深入Linux文件描述符与重定向:解锁高效IO操作的秘密
  • 283. 移动零
  • 【2024华为杯数学建模竞赛】E题 解题思路 | 视频特征提取
  • 麒麟银河桌面版,成功安装cuda12.6,mysql
  • Python环境搭建
  • uniApp微信小程序扫描普通二维码跳转到小程序指定页面操作方法
  • g1:基于 Llama,用提示工程实现类似 o1 的深度推理