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

前端html中让两个或者多个div在一行显示,用style给div加上css样式

文章目录

  • 前言
  • 一、怎么让多个div在一行显示


前言

DIV是层叠样式表中的定位技术,全称DIVision,即为划分。有时可以称其为图层。DIV在编程中又叫做整除,即只得商的整数。 DIV元素是用来为HTML(标准通用标记语言下的一个应用)文档内大块(block-level)的内容提供结构和背景的元素。
我们知道,默认情况下每个div都是单独一行显示的,那么怎么让多个div在一行显示呢?


一、怎么让多个div在一行显示

<div style="display:flex;font-weight:bold ">图示:</div>
<div style="display:flex;font-weight:bold "><div style="float: left;margin-right: 38px;">格口:</div><div style="background:#7ea9dc;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:gray;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">禁用</div><div style="background:orange;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">集包</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div><div style="background:yellow;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">装货量</div>
</div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 38px;">小车:</div><div style="background:#44FF8C;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div>
</div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 20px;">供件台 :</div><div style="background:#44ff8c;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">运行</div><div style="background:#b195d2;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">待机</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div></div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 10px;">直线电机:</div><div style="background:#44FF8C;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:orange;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">告警</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div>
</div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 38px;">紧停:</div><div style="background:gold;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">按下</div></div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 38px;">电刷:</div><div style="background:#44FF8C;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div>
</div>
<div style="display:flex;font-weight:bold"><div style="float: left;margin-right: 20px;">灰度仪 :</div><div style="background:#44FF8C;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">正常</div><div style="background:red;width:15px;height:15px;float: left;margin-right: 5px;margin-top: 4px;"></div><div style="float: left;margin-right: 15px;">故障</div>
</div>

显示结果:
在这里插入图片描述

http://www.lryc.cn/news/98396.html

相关文章:

  • 【linux基础(二)】Linux基本指令(中)
  • ceph集群---使用RBD块存储
  • 2022.09.17【读书笔记】丨生物信息学与功能基因组学(第十三章 蛋白质结构预测 下)
  • ardupilot获取飞行员目标倾斜角度
  • 机器人制作开源方案 | 智能垃圾桶
  • 【手撕】list
  • QMQTT快速入门
  • Dooring-Saas低代码技术详解
  • Linux chmod
  • java商城系统和php商城系统有什么差异?如何选择?
  • 【HTML】常用实体字符(如 nbsp; 空格)
  • 华为eNSP通过VMnet8虚拟网卡,NAT转换访问互联网
  • 手撕顺序表
  • Python实战项目——旅游数据分析(四)
  • 前端CryptoJS-AES加解密 对应php的AES-128-CBC加解密踩坑(java也相同加解密)
  • Python解码张三的法外狂徒之旅,揭秘视频背后的真相!【含jS逆向解密】
  • 【解析】对比学习和孪生网络的关系
  • Java版本企业工程项目管理系统平台源码(三控:进度组织、质量安全、预算资金成本、二平台:招采、设计管理)
  • 智能井盖:科技赋能城市脚下安全
  • wangeditor编辑器配置
  • Sqlite使用WAL模式指南
  • 一套高质量可靠的 React Hooks 库
  • 集合---list接口及实现类
  • JVM简述
  • 7.25训练总结
  • java注解@FeignClient修饰的类路径不在spring boot入口类所在的包下,有哪几种处理方式?
  • 神经网络随记-参数矩阵、剪枝、模型压缩、大小匹配、、
  • 4、Kubernetes 集群 YAML 文件详解
  • leetcode93. 复原 IP 地址(java)
  • 极光Java 版本服务器端实现别名消息推送