记录-diaplay: inline;

本文详细介绍了CSS中display:inline的作用,它使得元素如span、div等能以内联方式显示,避免自动换行。了解这一属性对于前端布局至关重要,尤其在调整元素显示方式和优化页面布局时。
diaplay: inline;

作用:设置对象作为行内元素展示,inline是内联对象的默认值例如span,div的display设置为inline的话,可以一行显示

不自动产生换行的元素称为内联对象

<div class="ui-g"> <div class="ui-g-12 ui-md-6 ui-lg-4"> <p:outputPanel id="axis_panel" class="scroll-part" style="height:900px" rendered="#{monitor.dataMap.get(&#39;五轴精框&#39;).size() > 0}"> <h3 style="text-align: center;font-size:40px;font-weight: bold;">五轴精框</h3> <p:outputPanel styleClass="item-processed"> <p:outputLabel value="订单货期" style="font-size:35px;width:220px;display: inline-block;"/> <p:spacer height="20"/> <p:outputLabel value="总工时" style="font-size:35px;width:150px;display: inline-block;"/> <p:spacer height="20"/> </p:outputPanel> <p:repeat value="#{monitor.dataMap.get(&#39;五轴精框&#39;)}" var="item"> <p:outputPanel styleClass="item-processed" style="color:#{item.isPass ? &#39;white&#39; : &#39;black&#39;}; background-color:#{item.isPass ? &#39;red&#39; : &#39;white&#39;}"> <p:outputLabel value="#{item.requestDateV2}" style="font-size:50px;width:220px;display: inline-block;"> <f:convertDateTime pattern="dd日/MM" timeZone="GMT+8"/> </p:outputLabel> <p:spacer height="20"/> <p:outputLabel value="#{item.allProcessHour}H" style="font-size:50px;width:150px;display: inline-block;"/> </p:outputPanel> </p:repeat> </p:outputPanel> <p:outputPanel id="axis_panel2" class="scroll-part" style="height:900px" rendered="#{monitor.dataMap.get(&#39;五轴精框&#39;).size() == 0}"> <p:outputLabel value="暂无货期订单跟进" style="font-size:45px;"/> </p:outputPanel> </div> <div class="ui-g-12 ui-md-6 ui-lg-4"> <p:outputPanel id="axis_panelV2" class="scroll-part" style="height:900px" rendered="#{monitor.dataMap.get(&#39;七轴枪钻&#39;).size() > 0}"> <h3 style="text-align: center;font-size:40px;font-weight: bold;">七轴枪钻</h3> <p:outputPanel styleClass="item-processed"> <p:outputLabel value="订单货期" style="font-size:35px;width:220px;display: inline-block;"/> <p:spacer height="20"/> <p:outputLabel value="总工时" style="font-size:35px;width:150px;display: inline-block;"/> <p:spacer height="20"/> </p:outputPanel> <p:repeat value="#{monitor.dataMap.get(&#39;七轴枪钻&#39;)}" var="itemV2"> <p:outputPanel styleClass="item-processed" style="color:#{itemV2.isPass ? &#39;white&#39; : &#39;black&#39;}; background-color:#{itemV2.isPass ? &#39;red&#39; : &#39;white&#39;}"> <p:outputLabel value="#{itemV2.requestDateV2}" style="font-size:50px;width:220px;display: inline-block;"> <f:convertDateTime pattern="dd日/MM" timeZone="GMT+8"/> </p:outputLabel> <p:spacer height="20"/> <p:outputLabel value="#{itemV2.allProcessHour}H" style="font-size:50px;width:150px;display: inline-block;"/> </p:outputPanel> </p:repeat> </p:outputPanel> <p:outputPanel id="axis_panel2V2" class="scroll-part" style="height:900px" rendered="#{monitor.dataMap.get(&#39;七轴枪钻&#39;).size() == 0}"> <p:outputLabel value="暂无货期订单跟进" style="font-size:45px;"/> </p:outputPanel> </div> <div class="ui-g-12 ui-lg-4" rendered="#{monitor.dataMap.get(&#39;线切割&#39;).size() > 0}"> <p:outputPanel id="axis_panelV3" class="scroll-part" style="height:900px"> <h3 style="text-align: center;font-size:40px;font-weight: bold;">线切割</h3> <p:outputPanel styleClass="item-processed"> <p:outputLabel value="订单货期" style="font-size:35px;width:220px;display: inline-block;"/> <p:spacer height="20"/> <p:outputLabel value="总工时" style="font-size:35px;width:150px;display: inline-block;"/> <p:spacer height="20"/> </p:outputPanel> <p:repeat value="#{monitor.dataMap.get(&#39;线切割&#39;)}" var="itemV3"> <p:outputPanel styleClass="item-processed" style="color:#{itemV3.isPass ? &#39;white&#39; : &#39;black&#39;}; background-color:#{itemV3.isPass ? &#39;red&#39; : &#39;white&#39;}"> <p:outputLabel value="#{itemV3.requestDateV2}" style="font-size:50px;width:220px;display: inline-block;"> <f:convertDateTime pattern="dd日/MM" timeZone="GMT+8"/> </p:outputLabel> <p:spacer height="20"/> <p:outputLabel value="#{itemV3.allProcessHour}H" style="font-size:50px;width:150px;display: inline-block;"/> </p:outputPanel> </p:repeat> </p:outputPanel> </div> </div> 请在这基础上,如果三列中有一列无记录,栅格自动变为两列显示布局
12-09
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>企业员工打卡系统</title> <!-- 引入Element Plus样式 --> <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: &#39;Helvetica Neue&#39;, Helvetica, &#39;PingFang SC&#39;, &#39;Hiragino Sans GB&#39;, Arial, sans-serif; } body { background-color: #f5f7fa; color: #333; line-height: 1.6; padding: 20px; } .container { max-width: 1000px; margin: 0 auto; padding: 20px; } header { text-align: center; margin-bottom: 30px; padding: 20px 0; border-bottom: 1px solid #ebeef5; } h1 { color: #409eff; font-size: 28px; margin-bottom: 10px; } .dashboard { display: flex; gap: 20px; margin-bottom: 30px; } .clock-card { flex: 1; background: #fff; border-radius: 8px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); padding: 25px; transition: all 0.3s; } .clock-card:hover { transform: translateY(-5px); box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.15); } .card-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; color: #606266; display: flex; align-items: center; } .card-title i { margin-right: 8px; font-size: 20px; color: #409eff; } .input-group { margin-bottom: 20px; } .el-input { position: relative; font-size: 14px; display: inline-block; width: 100%; } .el-input__inner { -webkit-appearance: none; background-color: #fff; background-image: none; border-radius: 4px; border: 1px solid #dcdfe6; color: #606266; display: inline-block; font-size: inherit; height: 40px; line-height: 40px; outline: none; padding: 0 15px; transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); width: 100%; } .el-input__inner:focus { border-color: #409eff; } .button-group { display: flex; gap: 12px; } .el-button { display: inline-flex; justify-content: center; align-items: center; line-height: 1; height: 40px; white-space: nowrap; cursor: pointer; background: #fff; border: 1px solid #dcdfe6; color: #606266; -webkit-appearance: none; text-align: center; box-sizing: border-box; outline: none; margin: 0; transition: .1s; font-weight: 500; padding: 12px 20px; font-size: 14px; border-radius: 4px; flex: 1; } .el-button--primary { color: #fff; background-color: #409eff; border-color: #409eff; } .el-button--primary:hover { background: #66b1ff; border-color: #66b1ff; } .el-button--success { color: #fff; background-color: #67c23a; border-color: #67c23a; } .el-button--success:hover { background: #85ce61; border-color: #85ce61; } .records-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); padding: 25px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th { background-color: #fafafa; color: #909399; font-weight: 600; text-align: left; padding: 12px 15px; border-bottom: 1px solid #ebeef5; } td { padding: 12px 15px; border-bottom: 1px solid #ebeef5; color: #606266; } tr:hover td { background-color: #f5f7fa; } .el-tag { display: inline-block; height: 32px; line-height: 30px; font-size: 12px; border-radius: 4px; box-sizing: border-box; white-space: nowrap; padding: 0 10px; } .el-tag--primary { color: #409eff; background-color: #ecf5ff; border-color: #d9ecff; } .el-tag--success { color: #67c23a; background-color: #f0f9eb; border-color: #e1f3d8; } .status-indicator { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; } .status-in { background-color: #409eff; } .status-out { background-color: #67c23a; } .empty-message { text-align: center; padding: 40px 0; color: #909399; } .empty-message i { font-size: 60px; color: #c0c4cc; margin-bottom: 20px; display: block; } .clock-time { font-size: 36px; font-weight: bold; text-align: center; color: #409eff; margin: 15px 0; font-family: &#39;Courier New&#39;, monospace; } .date-display { text-align: center; color: #909399; margin-bottom: 20px; } .name-display { margin: 20px 0 10px; font-size: 2.2rem; font-weight: 600; letter-spacing: 2px; font-family: &#39;Helvetica Neue&#39;, Arial, sans-serif; } .first-name { color: #303133; position: relative; } footer { text-align: center; margin-top: 40px; color: #909399; font-size: 14px; } @media (max-width: 768px) { .dashboard { flex-direction: column; } } </style> </head> <body> <div class="container"> <header> <h1>企业员工打卡系统</h1> <div class="date-display" id="currentDate"></div> <div class="clock-time" id="currentTime"></div> </header> <div class="dashboard"> <div class="clock-card"> <div class="card-title"> <span>员工打卡</span> </div> <div class="input-group"> <div class="el-input"> <input type="text" class="el-input__inner" id="employeeName" placeholder="请输入您的姓名"> </div> </div> <!-- <div class="name-display">--> <!-- <span id="employeeName" class="first-name"></span>--> <!-- </div>--> <div class="button-group"> <button class="el-button el-button--primary" id="clockInBtn">上班打卡</button> <button class="el-button el-button--success" id="clockOutBtn">下班签退</button> </div> </div> <div class="clock-card"> <div class="card-title"> <span>今日打卡状态</span> </div> <div id="todayStatus" class="empty-message"> <div>暂无今日打卡记录</div> </div> </div> </div> <div class="records-card"> <div class="card-title"> <span>打卡记录</span> </div> <div id="recordsTable"> <table> <thead> <tr> <th>员工姓名</th> <th>打卡时间</th> <th>打卡类型</th> </tr> </thead> <tbody id="recordsBody"> <!-- 记录将通过JS动态添加 --> </tbody> </table> <div id="emptyMessage" class="empty-message"> <div>暂无打卡记录</div> </div> </div> </div> <footer> <p>企业员工打卡系统 © 2023</p> </footer> </div> <script> // 模拟API请求的URL const API_BASE_URL = &#39;http://localhost:8080/api/clock&#39;; // DOM元素 const employeeNameInput = document.getElementById(&#39;employeeName&#39;); const clockInBtn = document.getElementById(&#39;clockInBtn&#39;); const clockOutBtn = document.getElementById(&#39;clockOutBtn&#39;); const recordsBody = document.getElementById(&#39;recordsBody&#39;); const emptyMessage = document.getElementById(&#39;emptyMessage&#39;); const todayStatus = document.getElementById(&#39;todayStatus&#39;); const currentDate = document.getElementById(&#39;currentDate&#39;); const currentTime = document.getElementById(&#39;currentTime&#39;); // 初始化函数 function init() { // 设置当前日期和时间 updateDateTime(); setInterval(updateDateTime, 1000); // 绑定按钮事件 clockInBtn.addEventListener(&#39;click&#39;, () => clock(&#39;IN&#39;)); clockOutBtn.addEventListener(&#39;click&#39;, () => clock(&#39;OUT&#39;)); // 获取url地址参数 const dqurl = new URL(window.location.href); const dqparams = new URLSearchParams(dqurl.search); const dquserName = dqparams.get(&#39;userName&#39;); document.getElementById(&#39;employeeName&#39;).textContent = dquserName; // 加载打卡记录 loadRecords(); } // 更新日期和时间 function updateDateTime() { const now = new Date(); currentDate.textContent = now.toLocaleDateString(&#39;zh-CN&#39;, { year: &#39;numeric&#39;, month: &#39;long&#39;, day: &#39;numeric&#39;, weekday: &#39;long&#39; }); currentTime.textContent = now.toLocaleTimeString(&#39;zh-CN&#39;); } // 打卡函数 function clock(type) { // const name = employeeNameInput.value.trim(); const name = employeeNameInput.textContent; if (!name) { alert(&#39;请重新登录&#39;); return; } // 模拟API请求 const endpoint = type === &#39;IN&#39; ? &#39;in&#39; : &#39;out&#39;; const url = `${API_BASE_URL}/${endpoint}?name=${encodeURIComponent(name)}`; // 显示加载状态 const originalText = type === &#39;IN&#39; ? clockInBtn.textContent : clockOutBtn.textContent; const button = type === &#39;IN&#39; ? clockInBtn : clockOutBtn; button.textContent = &#39;处理中...&#39;; button.disabled = true; // 模拟API请求延迟 setTimeout(() => { // 创建打卡记录对象 const record = { id: Date.now(), employeeName: name, clockTime: new Date().toISOString(), clockType: type }; // 添加到本地存储 saveRecord(record); // 更新UI addRecordToTable(record); updateTodayStatus(); // 显示成功消息 alert(type === &#39;IN&#39; ? `${name} 上班打卡成功!` : `${name} 下班签退成功!`); // 恢复按钮状态 button.textContent = originalText; button.disabled = false; // 清空输入框 employeeNameInput.value = &#39;&#39;; }, 800); } 保存记录到本地存储 function saveRecord(record) { const records = JSON.parse(localStorage.getItem(&#39;clockRecords&#39;) || &#39;[]&#39;); records.unshift(record); localStorage.setItem(&#39;clockRecords&#39;, JSON.stringify(records)); } // 从本地存储加载记录 function loadRecords() { const records = JSON.parse(localStorage.getItem(&#39;clockRecords&#39;) || &#39;[]&#39;); if (records.length === 0) { emptyMessage.style.display = &#39;block&#39;; recordsBody.innerHTML = &#39;&#39;; } else { emptyMessage.style.display = &#39;none&#39;; recordsBody.innerHTML = &#39;&#39;; records.forEach(record => { addRecordToTable(record); }); } updateTodayStatus(); } // 添加记录到表格 function addRecordToTable(record) { const row = document.createElement(&#39;tr&#39;); // 格式化日期时间 const clockTime = new Date(record.clockTime); const formattedTime = clockTime.toLocaleString(&#39;zh-CN&#39;); // 创建行内容 row.innerHTML = ` <td>${record.employeeName}</td> <td>${formattedTime}</td> <td> <span class="el-tag ${record.clockType === &#39;IN&#39; ? &#39;el-tag--primary&#39; : &#39;el-tag--success&#39;}"> ${record.clockType === &#39;IN&#39; ? &#39;上班打卡&#39; : &#39;下班签退&#39;} </span> </td> `; recordsBody.prepend(row); emptyMessage.style.display = &#39;none&#39;; } // 更新今日打卡状态 function updateTodayStatus() { const records = JSON.parse(localStorage.getItem(&#39;clockRecords&#39;) || &#39;[]&#39;); const today = new Date().toDateString(); // 筛选今日记录 const todayRecords = records.filter(record => { const recordDate = new Date(record.clockTime).toDateString(); return recordDate === today; }); if (todayRecords.length === 0) { todayStatus.innerHTML = &#39;<div>暂无今日打卡记录</div>&#39;; return; } // 按时间排序 todayRecords.sort((a, b) => new Date(a.clockTime) - new Date(b.clockTime)); // 生成状态HTML let statusHtml = &#39;&#39;; todayRecords.forEach(record => { const time = new Date(record.clockTime).toLocaleTimeString(&#39;zh-CN&#39;); statusHtml += ` <div class="status-item"> <span class="status-indicator ${record.clockType === &#39;IN&#39; ? &#39;status-in&#39; : &#39;status-out&#39;}"></span> <span>${time} - ${record.clockType === &#39;IN&#39; ? &#39;上班打卡&#39; : &#39;下班签退&#39;}</span> </div> `; }); todayStatus.innerHTML = statusHtml; } // 页面加载完成后初始化 document.addEventListener(&#39;DOMContentLoaded&#39;, init); </script> </body> </html> 将上诉的写成调用接口的方式,不存储在本地
08-28
```html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>记仇小本本</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: &#39;Microsoft YaHei&#39;, sans-serif; } body { background-color: #f5f5f5; color: #333; line-height: 1.6; } .container { max-width: 800px; margin: 0 auto; padding: 20px; } header { text-align: center; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 2px solid #e74c3c; } h1 { color: #e74c3c; font-size: 2.2rem; margin-bottom: 10px; } .description { color: #666; font-size: 0.9rem; } .input-section { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); margin-bottom: 20px; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; } input, textarea, select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; } textarea { height: 100px; resize: vertical; } button { background-color: #e74c3c; color: white; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; font-size: 1rem; transition: background-color 0.3s; } button:hover { background-color: #c0392b; } .search-section { background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); margin-bottom: 20px; } .records-section { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } .record-item { padding: 15px; border-bottom: 1px solid #eee; position: relative; } .record-item:last-child { border-bottom: none; } .record-title { font-weight: bold; font-size: 1.1rem; color: #e74c3c; margin-bottom: 5px; } .record-content { margin-bottom: 8px; color: #555; } .record-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: #888; } .record-category { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 0.8rem; margin-right: 8px; } .delete-btn { position: absolute; top: 15px; right: 15px; background: none; border: none; color: #999; cursor: pointer; font-size: 1.2rem; } .delete-btn:hover { color: #e74c3c; } .empty-state { text-align: center; padding: 30px; color: #999; } .category-work { background-color: #e8f4fd; color: #2980b9; } .category-life { background-color: #f0f8e8; color: #27ae60; } .category-relationship { background-color: #fde8f0; color: #e84393; } .category-other { background-color: #f8f8f8; color: #7f8c8d; } </style> </head> <body> <div class="container"> <header> <h1>记仇小本本</h1> <p class="description">记录那些不该忘记的事情,但请记住:宽容是美德,放下是智慧</p> </header> <section class="input-section"> <div class="form-group"> <label for="title">事件标题</label> <input type="text" id="title" placeholder="简要描述事件..."> </div> <div class="form-group"> <label for="content">详细内容</label> <textarea id="content" placeholder="详细描述发生了什么..."></textarea> </div> <div class="form-group"> <label for="category">分类</label> <select id="category"> <option value="work">工作相关</option> <opt
11-27
帮我使用html显示按钮后反馈是否开关,需要全部代码 HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 <!DOCTYPE html> <html> <head> <title>ESP32 AP控制中心</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <style> * { box-sizing: border-box; font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif; } body { background: linear-gradient(135deg, #f5f7fa 0%, #e4efe9 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; margin: 0; padding: 20px; } .container { background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); padding: 30px; max-width: 450px; width: 100%; text-align: center; } h1 { color: #2c3e50; margin-bottom: 20px; font-size: 2rem; } .card { background: #ffffff; border-radius: 12px; padding: 25px; margin: 20px 0; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); } .button { display: inline-block; background: #3498db; border: none; color: white; padding: 16px 40px; text-align: center; font-size: 18px; margin: 12px; cursor: pointer; border-radius: 50px; width: 220px; transition: all 0.3s ease; box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3); font-weight: 600; text-decoration: none; } .button:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4); } .button:active { transform: translateY(1px); } .button-off { background: #e74c3c; box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3); } .button-off:hover { box-shadow: 0 6px 12px rgba(231, 76, 60, 0.4); } .status { font-size: 18px; color: #7f8c8d; margin: 15px 0; font-weight: 500; } footer { margin-top: 20px; color: #95a5a6; font-size: 14px; } </style> </head> <body> <div class="container"> <h1>ESP32 AP控制中心</h1> <div class="card"> <h2>LED手动控制</h2> <a href="/?led1" class="button button-off">开关 LED1</a><br> <a href="/?led2" class="button button-off">开关 LED2</a> <div class="status">当前状态: 所有LED已关闭</div> </div> <footer> ESP32物联网控制器 | 在线状态: 正常 </footer> </div> </body> </html>
09-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值