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

news2024/9/23 23:26:40

文章目录

  • 前言
  • 一、怎么让多个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.coloradmin.cn/o/798651.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何在MacBook上彻底删除mysql

好久以前安装过&#xff0c;但是现在配置mysql一直出错&#xff0c;索性全部删掉重新配置。 一、停止MySQL服务 首先&#xff0c;请确保 MySQL 服务器已经停止运行&#xff0c;以免影响后续的删除操作。 sudo /usr/local/mysql/support-files/mysql.server stop如果你输入之…

DAY3,Qt(完成闹钟的实现,定时器事件处理函数的使用)

1.完成闹钟的实现&#xff0c;到点播报文本框的内容&#xff1b; ---alarm.h---头文件 #ifndef ALARM_H #define ALARM_H#include <QWidget> #include <QTimerEvent> //定时器处理函数类 #include <QTime> //时间类 #include <QPushButton> //按钮…

小红书舆情处理方法丨小红书负面笔记处理的三种技巧

小红书作为一个生活分享平台&#xff0c;经常会刷到一些负面笔记。更多用户的浏览&#xff0c;点赞收藏&#xff0c;评论行为会使笔记热度更高&#xff0c;笔记搜索排名靠前&#xff0c;如果品牌对负面舆情处置方法不当很可能影响公司品牌信誉&#xff0c;导致用户流失。 小红书…

WEB:unseping

背景知识 php序列化和反序列化 命令执行绕过方式 题目 进行代码审计 可知为反序列化 整体是创建case类&#xff0c;可接受post传来的ctf值 _consturuct函数,是在函数调动前启用&#xff0c;构造了$method和$args两个变量。 _dexstruct函数在变量摧毁的时使用&#xff0c;所…

HDU - 7315 Data Generation( 2023“钉耙编程”中国大学生算法设计超级联赛第四场 D)

题目大意 Yoshinow2001 \text{Yoshinow2001} Yoshinow2001 正在为他的问题生成数据。他想要生成 { 0 , … , n − 1 } \{0,…,n−1\} {0,…,n−1} 的一个随机排列&#xff0c;因此他使用了以下算法&#xff1a; 在这里&#xff0c;我们可以假设函数 rand ⁡ ( ) m o d n \ope…

超声功率放大器基本原理和设计流程

超声功率放大器是一种将低功率信号放大到高功率信号的设备&#xff0c;是实现超声成像、治疗和检查的关键组件。它主要由功率放大电路、控制电路、保护电路等部分组成。本文将介绍超声功率放大器的技术方案&#xff0c;包括其基本原理、设计流程及注意事项。 基本原理 超声功率…

闭环排队理论简介

闭环排队理论简介 1. 系统情景2. 数学描述 在排队理论简介一文中&#xff0c;笔者详细介绍了排队理论的基本内容。在该文中&#xff0c;申请流是来自系统外部的&#xff0c;其强度&#xff08;或密度&#xff09;并不取决于系统本身&#xff0c;也不取决于系统的状态。而在本文…

网络安全法律法规

数据参考&#xff1a;CISP官方 目录 国家立法体系网络安全法解析网络安全相关法律 一、国家立法体系 1、我国的立法体系 我国的立法体系在网络空间治理中扮演着基础工作的角色。为了应对快速发展的网络技术和威胁&#xff0c;我国采取了多级立法机制来完善网络空间的法律…

【uniapp】十分钟带你封装uniapp的api请求

前端面试题库 &#xff08;面试必备&#xff09; 推荐&#xff1a;★★★★★ 地址&#xff1a;前端面试题库 前言 最近刚好接了个私活&#xff0c;顺便把之前做到的项目中没有写出来的功能点单独拿出来写一篇吧&#xff01; 其实在我的uniapp专栏里面写了不少关…

Kafka 入门到起飞系列 - 怎么从ISR中选出的Leader呢? Leader选举机制

上文我们讲了分区分成Leader 和 Follower两种角色&#xff0c;当Leader宕机后&#xff0c;会从ISR同步副本中选出一个分区作为leader分区继续工作&#xff0c;那么leader是怎么选出来的呢&#xff1f; 怎么从ISR中选出的Leader呢&#xff1f; Leader选举机制 比如有这么个分布…

梯度下降法和牛顿法

梯度下降法和牛顿法都是优化方法。 梯度下降法 梯度下降法和相关知识可以参考导数、偏导数、梯度、方向导数、梯度下降、二阶导数、二阶方向导数一文。梯度下降法是一种迭代地每次沿着与梯度相反方向前进的不断降低损失函数的优化方法。梯度下降只用到一阶导数的信息&#xf…

word怎么转换成pdf?分享几种转换方法

word怎么转换成pdf&#xff1f;将Word文档转换成PDF文件有几个好处。首先&#xff0c;PDF文件通常比Word文档更容易在不同设备和操作系统上查看和共享。其次&#xff0c;PDF文件通常比Word文档更难以修改&#xff0c;这使得它们在需要保护文件内容的情况下更加安全可靠。最后&a…

Linux 学习记录59(ARM篇)

Linux 学习记录59(ARM篇) 本文目录 Linux 学习记录59(ARM篇)一、IIC总线1. 概念2. IIC总线硬件连接 二、系统框图三、IIC时序1. 起始信号 / 停止信号2. 数据传输信号3. 应答信号 / 非应答信号4. 寻址信号 四、IIC协议1. 主机给从机发送一个字节(写)2. 主机给从机发送多个连续字…

Lab———Git使用指北

Lab———Git使用指北 &#x1f916;:使用IDEA Git插件实际工作流程 &#x1f4a1; 本文从实际使用的角度出发&#xff0c;以IDEA Git插件为基本讲述了如果使用IDEA的Git插件来解决实际开发中的协作开发问题。本文从 远程仓库中拉取项目&#xff0c;在本地分支进行开发&#x…

【C++】STL中list的模拟实现(增删查改,迭代器封装,运算符重载)

文章目录 前言大体框架&#xff1a; 一、节点的封装&#xff08;list_node&#xff09;二、迭代器的封装(_list_iterator)1.类模板的定义&#xff1a;2.构造函数3.前置&#xff0c;后置4.前置--&#xff0c;后置--5.解引用(operator*())6. ->重载&#xff08;operator- >…

代码随想录算法学习心得 49 | 647.回文子串、516.最长回文子序列...

一、最长回文子序列 链接&#xff1a;力扣 描述&#xff1a;给你一个字符串 s &#xff0c;找出其中最长的回文子序列&#xff0c;并返回该序列的长度。 子序列定义为&#xff1a;不改变剩余字符顺序的情况下&#xff0c;删除某些字符或者不删除任何字符形成的一个序列。 思…

练习时长两年半的入侵检测

计算机安全的三大中心目标是&#xff1a;保密性 (Conf idential ity) 、完整性 (Integrity) 、可用性 (Availability) 。 身份认证与识别、访问控制机制、加密技术、防火墙技术等技术共同特征就是集中在系统的自身加固和防护上&#xff0c;属于静态的安全防御技术&#xff0c;…

将Python远控隐藏在文档图片中的行动分析

1、概述 ** **近日&#xff0c;安天CERT通过网络安全监测发现了一起恶意文档释放Python编写的远控木马事件。通过文档内容中涉及的组织信息和其中攻击者设置的诱导提示&#xff0c;安天CERT判断该事件是一起针对阿塞拜疆共和国国家石油公司进行的定向攻击活动。此次事件中&…

单线程与多线程的理解与学习(入门到深入)

文章目录 一、在Java中&#xff0c;有多种方式可以创建线程。以下是几种常用的方法&#xff1a;二、线程的调度线程的调度分为两种调度模型分时调度模型抢占式调度模型 三、线程传值四、什么是线程同步五、线程安全六、线程的同步机制七、线程控制 一、在Java中&#xff0c;有多…

惠普HP Color Laser 150a开机红色感叹号闪烁不打印故障解决方法

故障描述&#xff1a; 惠普HP Color Laser 150a开机红色感叹号闪烁&#xff0c;不能打印&#xff0c;电脑提示C3-6140。 检测分析&#xff1a; 在解决C3-6140错误代码之前&#xff0c;我们需要先检查打印机是否连接正常。如果打印机连接不正常&#xff0c;也可能会出现这个错误…