当前位置:网站首页>bootstrap如何清除浮动的样式
bootstrap如何清除浮动的样式
2022-06-23 05:00:00 【亿速云】
bootstrap如何清除浮动的样式
这篇文章主要介绍“bootstrap如何清除浮动的样式”,在日常操作中,相信很多人在bootstrap如何清除浮动的样式问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”bootstrap如何清除浮动的样式”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
在bootstrap中,可以利用“.clearfix”辅助类来清除浮动的样式,辅助类是bootstrap提供的一组工具类,用于辅助项目的开发,只需要给需要清除浮动的元素设置类名为“.clearfix”即可,语法为“<元素 class="clearfix">”。
本教程操作环境:Windows10系统、bootstrap5版、DELL G3电脑
bootstrap怎么清除浮动的样式
bootstrap提供了一组工具类,用于辅助项目的开发
前台用的是bootstrap做的,遇到需要清除浮动的,查过资料之后找到了个方法。
<div class="clearfix"></div>
在需要清除浮动的地方加上这个就行了!
示例如下:
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Bootstrap 实例 - 清除浮动</title><link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script><script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script></head><body><div class="clearfix" style="background: #D8D8D8;border: 1px solid #000;padding: 10px;"><div class="pull-left" style="background:#58D3F7;"> 向左快速浮动 </div> <div class="pull-right" style="background: #DA81F5;"> 向右快速浮动 </div></div></body></html>
输出结果:

设置辅助类:
<div class="clearfix" style="background: #D8D8D8;border: 1px solid #000;padding: 10px;"><div class="clearfix" style="background:#58D3F7;"> 向左快速浮动 </div> <div class="pull-right" style="background: #DA81F5;"> 向右快速浮动 </div></div>
输出结果:

到此,关于“bootstrap如何清除浮动的样式”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
边栏推荐
- Linked Storage
- 如何为 Arduino IDE 安装添加库
- Basic RF theory (DB)
- Day_10 传智健康项目-权限控制、图形报表
- Day_05 传智健康项目-预约管理-预约设置
- Day_03 传智健康项目-预约管理-检查组管理
- 【Vivado那些事儿】XilinxCEDStore介绍
- matplotlib savefig多个图片叠加问题
- mysql读已提交和可重复度区别
- [focus on growth and build a dream for the future] - TDP year-end event, three chapters go to the Spring Festival!
猜你喜欢

Machine learning 3-ridge regression, Lasso, variable selection technique
![[open source project] excel export Lua configuration table tool](/img/3a/8e831c4216494d5497928bae21523b.png)
[open source project] excel export Lua configuration table tool

Day_06 传智健康项目-移动端开发-体检预约

mongodb 4.x绑定多个ip启动报错

Introduction to JVM principle

Design scheme of Small PLC based on t5l1

Progress of layer 2 technical scheme

CPU的功能和基本结构

Day_02 传智健康项目-预约管理-检查项管理

原址 交换
随机推荐
Progress of layer 2 technical scheme
Leetcode topic resolution integer to Roman
Fraction to recursing decimal
(1)基础学习——vim编辑器常用快捷操作命令
Long substring without repeating characters for leetcode topic resolution
JVM原理简介
Summary of ant usage (I): using ant to automatically package apk
[open source project] excel export Lua configuration table tool
Visual studio debugging tips
Tencent security 2021 report white paper collection (download attached)
Dora's Google SEO tutorial (1) SEO novice guide: establishment of preliminary optimization thinking
百度URL參數之LINK?URL參數加密解密研究(代碼實例)
Kotlin interface
Day_03 传智健康项目-预约管理-检查组管理
机器学习3-岭回归,Lasso,变量选择技术
Day_01 传智健康项目-项目概述和环境搭建
How to query fields separated by commas in MySQL as query criteria - find_ in_ Set() function
【DaVinci Developer专题】-41-APP SWC如何读取写入NVM Block数据
Ant Usage Summary (II): description of related commands
(1) Basic learning - Common shortcut commands of vim editor