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

HTML网页-练习float

划分 12个格子,第一栏为:人物简介;其他栏为人物名称;

使用float: left将格子左浮动。

设置格子背景颜色,字体颜色,鼠标放上去后的字体颜色和背景颜色。

 <style>.title {width: 100%;overflow: hidden;}.title-topic a {     /*以下元素应用于topic*/float: left;     /*左浮动,让12个格子在一行*/width: 8.33%;    /* 每个格子宽度为总宽度的 1/12 */box-sizing: border-box;text-align: center;    /*居中对齐*/background-color: #fea721;    /*背景颜色*/padding: 20px;display: block;       /*将元素显示为块级元素*/color: aqua;    /*文本颜色*/}.title-figure a {    /*以下元素应用于figure*/float: left;width: 8.33%; box-sizing: border-box;text-align: center;background-color: #fe722171;padding: 20px;display: block;color: rgb(15, 12, 13);}.title-figure a:hover{     /*悬停,鼠标移到格子时改变字体和背景颜色*/color: red;background-color: aqua;}.title-topic a:hover{color: red;background-color: aqua;}</style><div class="title"> /*#--#表示该链接的目标URL为当前页面本身,不会跳转到其他页面<div class="title-topic"><a href="#">人物简介</a></div><div class="title-figure"><a href="#">路飞</a></div><div class="title-figure"><a href="#">索隆</a></div><div class="title-figure"><a href="#">娜美</a></div><div class="title-figure"><a href="#">罗宾</a></div><div class="title-figure"><a href="#">乌索普</a></div><div class="title-figure"><a href="#">山治</a></div><div class="title-figure"><a href="#">甚平</a></div><div class="title-figure"><a href="#">乔巴</a></div><div class="title-figure"><a href="#">弗兰奇</a></div><div class="title-figure"><a href="#">布鲁克</a></div><div class="title-figure"><a href="#">大和</a></div></div>

下面是在bootcss上找的轮播组件,换上自己的图片 

/*在bootcss上找的轮播组件,加入自己的图片
<div id="carouselExampleIndicators" class="carousel slide"><div class="carousel-indicators"><button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button><button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button><button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2" aria-label="Slide 3"></button></div><div class="carousel-inner"><div class="carousel-item active"><img src="./static/img/The country of Wa.jpg" class="d-block w-100" alt="no"></div><div class="carousel-item"><img src="./static/img/home.jpg" class="d-block w-100" alt="no"></div><div class="carousel-item"><img src="./static/img/Ace.jpg" class="d-block w-100" alt="no"></div></div><button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev"><span class="carousel-control-prev-icon" aria-hidden="true"></span><span class="visually-hidden">Previous</span></button><button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next"><span class="carousel-control-next-icon" aria-hidden="true"></span><span class="visually-hidden">Next</span></button></div>

 展示:

 

相关文章:

  • Java 注解式限流教程(使用 Redis + AOP)
  • 【C++】C++面向对象设计的核心思想之一: 接口抽象、解耦和可扩展性
  • 【仿生机器人软件架构】通过整合认知系统实现自主精神性——认知系统非常具有可执行性
  • 深入解析 Redis Cluster 架构与实现(二)
  • python打卡day40@浙大疏锦行
  • AWS云创建安全审计用户组
  • 扫地机器人苦寻新引擎,大疆们却已攻入腹地
  • 基于微服务架构的社交学习平台WEB系统的设计与实现
  • 【交通 Traffic Transformer】同一篇文章,内容排版稍有不同 | 交通预测模型中,Transformer相比传统GCN模型有何优势?
  • 基于Vite的前端自动化部署方案
  • AI绘画提示词:解锁创意无限可能
  • 在Linux上安装Docker并配置镜像加速器:从入门到实战
  • C++面试题:Linux系统信号详解
  • 01流程定位
  • 信息化项目验收测试:MES 系统验收测试的测试重点
  • DeepSeek R1 模型小版本升级,DeepSeek-R1-0528都更新了哪些新特性?
  • 【Netty系列】Reactor 模式 1
  • C语言编程--21.两两交换链表中的结点
  • AI赋能SEO关键词策略
  • [FreeRTOS- 野火] - - - 临界段
  • #NAME?/seo优化推广业务员招聘
  • 无代码开发平台永久免费/自动app优化官网
  • 手机网站源码下载/互联网营销平台有哪些
  • 深圳网站设计网站制作/谁有恶意点击软件
  • 做网站维护是什么岗位/全面网络推广营销策划
  • 网络推广软件赚钱/windows优化大师是什么