font-size 解决带有文本内容的inline间距问题

CSS布局与间距调整技巧
本文介绍了如何使用CSS解决常见的布局问题,如去除列表样式、调整列表项的显示方式及解决图片间的多余间距等。通过调整父级元素的字体大小为0,并为子元素设置合适的字体大小,可以有效地消除由缩进和换行导致的空白问题。

如下代码

 <ul>
    <li>我是第一项</li>
    <li>我是第二项</li>
    <li>我是第三项</li>
    <li>我是第四项</li>
</ul>


 <style>
    ul {
        list-style: none;
    }
    li {
        width: 25%;
        display: inline-block;
        background: green;
        text-align: center;
        height: 40px;
        line-height: 40px;
    }
</style>

效果预览

往设置一些适当的缩进、换行,但当元素的display为inline或者inline-block的时候,这些缩进、换行就会产生空白,所以出现上述问题。虽然还有其他方法能解决我们因为缩进、换行而产生的问题,但此时,最合适的方法就是给li的父级ul设置: font-size: 0; 给li设置:font-size: 16px; 如此就达到了所需效果。

 ul {
        list-style: none;
        font-size: 0;
    }

效果预览
这里写图片描述


还可以解决图片的间距

<div>
     <img src="pic1.jpg">
     <img src="pic2.jpg">
</div>

引用块内容

给DIV设置font-size

div {
    font-size: 0;
}

效果预览
这里写图片描述

<template> <view class="container"> <!-- 🔝 顶部操作栏:选择文件 --> <view class="header-card card"> <button class="btn outline" @click="triggerFileInput"> 选择文件 </button> <!-- 隐藏的 input --> <input :type="typeFile" ref="fileInputRef" :accept="acceptTypes" :multiple="!isSingle" @change="handleFiles" style="display: none" /> </view> <!-- 📄 中间可滚动文件列表(占满剩余空间) --> <view class="file-list-container"> <view class="card file-list-wrapper" :style="{ minHeight: files.length > 0 ? '110px' : '273px' }"> <text class="section-title">已选文件</text> <view class="file-list" v-if="files.length > 0"> <view class="file-item" v-for="(file, index) in files" :key="index"> <uni-icons class="icon-img" :type="imgTypeFn(file.name)" ></uni-icons> <view class="file-item-box"> <view class="file-item-box-one">{{ file.name }}</view> <view class="file-item-box-two"> <view class="file-item-box-two-name">{{ userName }}</view> <view class="file-item-box-two-size">文件大小:{{ formatSize(file.size) }}</view> </view> </view> <!-- 删除按钮 --> <uni-icons class="delete-btn" color='#ff5252' type="shibai" @click="removeFile(index)"></uni-icons> </view> </view> <view v-else class="empty-tip"> <image src="/static/image/zy-workbench/noData.png" mode="widthFix" class="login-img" /> <text>暂无文件,请先选择</text> </view> </view> </view> <!-- 🔽 底部操作栏:上传按钮 --> <view class="footer-card card"> <button class="btn outline" @click="uploadFiles"> 确定上传 </button> </view> </view> <view v-if="hasPermissionIssue" class="permission-warning"> <text>🚫 当前环境可能无权访问文件,请检查浏览器权限设置</text> </view> </template> <script setup> import { ref, onMounted } from 'vue' import { onShow } from '@dcloudio/uni-app' // 是否已知有权限问题 const hasPermissionIssue = ref(false) // 可在 mounted 中尝试探测能力 onMounted(() => { try { // 简单测试能否创建 Blob URL const testBlob = new Blob(['test'], { type: 'text/plain' }) const url = URL.createObjectURL(testBlob) URL.revokeObjectURL(url) hasPermissionIssue.value = false } catch (e) { hasPermissionIssue.value = true console.error('浏览器可能受限,无法正常处理文件:', e) alert('⚠️ 浏览器权限受限,可能无法上传文件,请检查设置') } }) // 获取 URL 参数 const getUrlParameter = (name) => { const regex = new RegExp(`[?&]${name}=([^&#]*)`) const results = regex.exec(window.location.search) return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')) } // 获取 URL 参数并设置默认值 const maxCount = ref(null) const maxSize = ref(null) const isSingle = ref(null) const typeFile = ref(null) const uploadUrl = ref(null) const headers = ref(null) const otherParam = ref(null) const userName = ref(null) const acceptTypes = ref(null) onShow(() => { const pages = getCurrentPages(); console.log("🚀 ~ onShow ~ pages:", pages) const currentPage = pages[pages.length - 1]; console.log("🚀 ~ onShow ~ currentPage:", currentPage) const options = currentPage.$page.options; console.log("🚀 ~ onShow ~ options:", options) maxCount.value = parseInt(options.maxCount) || 10 console.log("🚀 ~ onShow ~ maxCount.value:", maxCount.value) maxSize.value = parseInt(options.maxSize) * 1024 * 1024 || Infinity console.log("🚀 ~ onShow ~ maxSize.value:", maxSize.value) isSingle.value = options.isSingle === 'true' console.log("🚀 ~ onShow ~ isSingle.value:", isSingle.value) typeFile.value = options.typeFile||'file' console.log("🚀 ~ onShow ~ typeFile.value :", typeFile.value ) uploadUrl.value = decodeURIComponent(options.uploadUrl)||'' console.log("🚀 ~ onShow ~ uploadUrl.value:", uploadUrl.value) headers.value = options.headers?JSON.parse(decodeURIComponent(options.headers)):null console.log("🚀 ~ onShow ~ headers.value:", headers.value) otherParam.value = options.otherParam?JSON.parse(decodeURIComponent(options.otherParam)):null console.log("🚀 ~ onShow ~ otherParam.value:", otherParam.value) userName.value = options.userName||'操作人' console.log("🚀 ~ onShow ~ userName.value:", userName.value) acceptTypes.value = options.accept || 'image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.ppt,.pptx,' + 'application/pdf,' + 'application/msword,' + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,' + 'application/vnd.ms-excel,' + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,' + 'text/plain' console.log("🚀 ~ onShow ~ acceptTypes.value:", acceptTypes.value) }) // 数据存储 const files = ref([]) const fileInputRef = ref(null) // 工具函数 const formatSize = (bytes) => { if (!bytes) return '0 KB' const k = 1024 const sizes = ['B', 'KB', 'MB', 'GB'] const i = Math.floor(Math.log(bytes) / Math.log(k)) return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] } const imgTypeFn = (name) => { let type = name.split('.').pop().toLowerCase() let imgType = 'oth' const typeMap = { img: ['png', 'jpg', 'jpeg', 'gif', 'bmp'], exel: ['xls', 'xlsx', 'xlsm'], word: ['doc', 'docx'], pdf: ['pdf'], ppt: ['ppt', 'pptx'], txt: ['txt'] } for (let key in typeMap) { if (typeMap[key].includes(type)) { imgType = key } } return imgType } const getFileExt = (filename) => { if (!filename) return '' const match = filename.trim().toLowerCase().match(/\.([a-z0-9]+)$/) return match ? match[1] : '' } const triggerFileInput = () => { if ( maxCount.value <= files.value.length) { uni.showToast({ title: `已达上限 ${maxCount.value} 个文件`, icon: 'none' }) return } const input = document.createElement('input') input.type = typeFile.value input.accept = acceptTypes.value input.multiple = !isSingle.value input.style.display = 'none' document.body.appendChild(input) // 获取 URL 参数并设置默认值 input.onchange = (event) => { handleFiles(event) document.body.removeChild(input) } input.click() } const handleFiles = async (event) => { const selectedFiles = event.target.files if (!selectedFiles || selectedFiles.length === 0) return const remainingSlots = maxCount.value - files.value.length let availableSlots = Math.min(remainingSlots, selectedFiles.length) const processedNames = [] const duplicates = [] const oversized = [] const added = [] for (const file of Array.from(selectedFiles)) { // 检查是否超出剩余槽位 if (processedNames.length >= availableSlots) break // 检查重复 const isDuplicate = files.value.some(f => f.name === file.name && f.size === file.size) if (isDuplicate) { duplicates.push(file.name) continue } // 检查大小 if (file.size > maxSize.value) { oversized.push(file.name) continue } // 合法文件 processedNames.push(file.name) try { const url = URL.createObjectURL(file) files.value.push({ name: file.name, size: file.size, type: file.type, url, nativePath: null }) added.push(file.name) } catch (err) { console.error('读取失败:', file.name, err.message) // 判断是否是权限/安全相关错误 const permissionRelated = err.message.includes('权限') || err.message.includes('安全策略') || err.message.includes('访问被拒绝') || err.message.includes('不可读') || err.message.includes('denied') if (permissionRelated) { uni.showToast({ title: `⚠️ 权限问题:\n${err.message}\n\n请检查文件是否受密码保护、是否正被其他程序使用,或尝试重新选择。`, icon: 'none' }) } else { uni.showToast({ title: `❌ 文件 "${file.name}" 读取失败:\n${err.message}`, icon: 'none' }) } } } // 统一反馈结果 let message = '' if (added.length > 0) { message += `✅ 成功添加 ${added.length} 个文件\n` } if (duplicates.length > 0) { message += `⚠️ 跳过 ${duplicates.length} 个重复文件:${duplicates.slice(0, 3).join(', ')}${duplicates.length > 3 ? '...' : ''}\n` } if (oversized.length > 0) { message += `❌ 跳过 ${oversized.length} 个超大文件:${oversized.slice(0, 3).join(', ')}${oversized.length > 3 ? '...' : ''}` } if (message) { console.log(message) uni.showToast({ title: message.trim(), icon: 'none' }) } } const removeFile = (index) => { const file = files.value[index] URL.revokeObjectURL(file.url) files.value.splice(index, 1) uni.showToast({ title: '已删除', icon: 'none' }) } const uploadFiles = async () => { console.log("🚀 ~ maxCount:", maxCount) console.log("🚀 ~ maxSize:", maxSize) console.log("🚀 ~ typeFile:", typeFile) console.log("🚀 ~ acceptTypes:", acceptTypes) console.log("🚀 ~ isSingle:", isSingle) if (files.value.length === 0) { uni.showToast({ title: `请先选择文件`, icon: 'none' }) return } if (!uploadUrl.value) { uni.showToast({ title: `未提供上传接口地址`, icon: 'none' }) return } const formData = new FormData() try { // 遍历每个文件项 for (const file of files.value) { const { url, name, type } = file // 检查是否有有效的 blob URL if (!url || !name) { console.warn('缺少文件 URL 或名称:', file) continue } // 通过 fetch 获取 blob 数据 const response = await fetch(url) const blob = await response.blob() // 将 Blob 作为文件添加到 FormData // 注意:第三个参数是推荐的文件名(否则可能默认为 "blob") formData.append('files', blob, name) } console.log("🚀111 ~ uploadFiles ~ formData:", formData) if (typeof otherParam.value === 'object' && otherParam.value !== null) { // 遍历所有属性,解构添加到 FormData Object.keys(otherParam.value).forEach(key => { formData.append(key, otherParam.value[key]) }) } console.log("🚀222 ~ uploadFiles ~ formData:", formData) // 发送请求 const response = await fetch(uploadUrl.value, { method: 'POST', body: formData, headers: { ...headers.value, } }) const data = await response.json() uni.showToast({ title: data.msg, icon: 'none' }) if(data.code==200){ files.value = [] } } catch (error) { console.error('上传失败:', error) uni.showToast({ title: '文件上传失败', icon: 'none' }) } } </script> <style scoped lang="scss"> .container { box-sizing: border-box; display: flex; flex-direction: column; width: auto; height: 100vh; margin: 0; padding: 8px; overflow: hidden; // 防止外层滚动 background-color: #f5f5f5; margin-bottom: env(safe-area-inset-bottom, 20px); /* 安全区域底部间距 */ } // 头部和底部卡片 .header-card, .footer-card { flex: 0 0 auto; padding: 12px 20px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); z-index: 10; } .header-card{ border-radius: 6px; height: 89px; padding: 20px 16px; box-sizing: border-box; .outline { background: #E3EFFF; height: 49px; border-radius: 4px; font-size: 15px; line-height: 49px; color: #0F56D5; text-align: center; font-weight: 400; &::after { border: 0.5px solid #BAD8FF !important; } } } .footer-card { flex: 0 0 auto; padding: 12px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); z-index: 10; .outline { background: #0F56D5; border-radius: 2px; height: 49px; font-size: 18px; color: #FFFFFF; text-align: center; font-weight: 400; } } // 中间滚动区域容器 .file-list-container { background-color: #f5f5f5; flex: 1; overflow-y: auto; display: flex; flex-direction: column; margin: 12px 0; } // 文件列表外层卡片(包裹滚动内容) .file-list-wrapper { // padding: 12px; display: flex; flex-direction: column; margin: 0; border-radius: 0; overflow: hidden; background-color: #FFFFFF !important; border-radius: 6px; } .section-title { font-size: 16px; color: #333333; letter-spacing: 0; font-weight: 500; margin-bottom: 7px; padding-top: 12px; padding-left: 12px; } .file-list { flex: 1; // padding: 0 10px; display: flex; flex-direction: column; overflow-y: auto; } .file-item { display: flex; align-items: center; /* 垂直居中对齐图标和文本 */ padding: 12px 15px; padding-left: 35px; background: #ffffff; font-size: 14px; position: relative; } // 左侧图标 .icon-img { width: 34px; height: 34px; min-width: 34px; min-height: 34px; font-size: 34px; // 如果 uni-icons 支持通过 font-size 控制大小 margin-right: 12px; color: #666; } // 右侧内容区域(占满剩余空间) .file-item-box { flex: 1; min-width: 0; /* 关键:允许内部内容触发省略号 */ display: flex; flex-direction: column; justify-content: center; line-height: 1.5; } // 文件名:单行省略 .file-item-box-one { font-weight: 500; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; } // 用户 & 大小:左右排列 .file-item-box-two { display: flex; align-items: center; font-size: 12px; color: #888; gap: 12px; /* 间距 */ } // 用户名 .file-item-box-two-name { max-width: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; // 可选限制宽度 } // 文件大小(自动收缩) .file-item-box-two-size { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; /* 占据剩余空间,优先被截断 */ } /* 给非第一个 item 添加上边框 */ .file-item:not(:first-child) { border-top: 1px solid #E5E6EB; /* 自定义颜色和样式 */ } .file-info { display: block; line-height: 1.6; } .preview-img { max-width: 100%; max-height: 200px; margin-top: 10px; border-radius: 6px; } .link { color: #1a73e8; text-decoration: underline; margin-top: 8px; display: inline-block; } .delete-btn { color: white; width: 24px; height: 24px; border: none; font-size: 14px; line-height: 1; text-align: center; cursor: pointer; opacity: 0.9; } .empty-tip { font-family: PingFangSC-Regular; font-size: 15px; color: rgba(0,0,0,0.60); letter-spacing: 0; text-align: center; line-height: 26px; font-weight: 400; display: flex; justify-content: center; align-items: center; flex-direction: column; } .permission-warning { background-color: #fff3cd; color: #856404; font-size: 13px; padding: 10px; text-align: center; border-radius: 6px; margin: 10px 15px; border: 1px solid #ffeaa7; } .login-img{ width: 151px; height: 91px; margin-top: 59px; margin-bottom: 7px; } </style> 让footer-card盒子永远在底部并且宽度是100vw,底部的内边距是安全距离加12px,并且file-list-container盒子内容不能被footer-card遮盖
10-11
<template> <div class="production-dashboard"> <!-- 顶部导航(含日期、页面切换) --> <div class="top-bar"> <div class="weather-info"> <span>{{ currentTime }}</span> <span>{{ currentDate }}</span> </div> <!-- 标题区域 --> <div class="title-section"> <h2 class="title">生产能力评估</h2> </div> <div class="page-switch"> <el-button type="text" icon="el-icon-s-home"></el-button> <el-button type="text" icon="el-icon-s-home"></el-button> <el-button type="text" icon="el-icon-s-home">放大</el-button> <el-button type="text" icon="el-icon-switch-button">关闭</el-button> </div> </div> <div class="button-container"> <!-- 左侧三个朝右的平行四边形按钮 --> <div class="left-buttons"> <button class="skew-button-left" :class="{ active: activeButton === '设备总览' }" @click="handleButtonClick('设备总览')" > 设备总览 </button> <button class="skew-button-left" :class="{ active: activeButton === '菜单二' }" @click="handleButtonClick('菜单二')" > 菜单二 </button> <button class="skew-button-left" :class="{ active: activeButton === '菜单三' }" @click="handleButtonClick('菜单三')" > 菜单三 </button> </div> <!-- 右侧三个朝左的平行四边形按钮 --> <div class="right-buttons"> <button class="skew-button-right" :class="{ active: activeButton === '菜单四' }" @click="handleButtonClick('菜单四')" > 菜单四 </button> <button class="skew-button-right" :class="{ active: activeButton === '菜单五' }" @click="handleButtonClick('菜单五')" > 菜单五 </button> <button class="skew-button-right" :class="{ active: activeButton === '菜单六' }" @click="handleButtonClick('菜单六')" > 菜单六 </button> </div> </div> <div class="workshop-buttons"> <button v-for="(workshop, index) in workshops" :key="index" :class="['workshop-btn', activeWorkshop === index ? 'active' : '']" @click="selectWorkshop(index)" > {{ workshop }} </button> </div> <div class="container"> <div class="row"> <!-- 卡片 1 --> <div class="card"> <div class="card-left"> <img src="@/views/product/img/shebeikaidonglv.png"> </div> <div class="card-right"> <p>良好台数 <span class="yellow-number">1</span></p> <p>正常台数 <span class="green-number">13</span></p> <p>告警台数 <span class="red-number">1</span></p> </div> </div> <!-- 卡片 2 --> <div class="card"> <div class="card-left"> <img src="@/views/product/img/xingneng.png"> </div> <div class="card-right"> <p>良好台数 <span class="red-number">0</span></p> <p>正常台数 <span class="green-number">15</span></p> <p>告警台数 <span class="yellow-number">0</span></p> </div> </div> <!-- 卡片 3 --> <div class="card"> <div class="card-left"> <img src="@/views/product/img/oeede.png"> </div> <div class="card-right"> <p>良好台数 <span class="red-number">1</span></p> <p>正常台数 <span class="green-number">13</span></p> <p>告警台数 <span class="yellow-number">1</span></p> </div> </div> </div> </div> <div class="app-container"> <!-- 循环生成 3 行 --> <div v-for="row in 3" :key="row" class="card-row"> <!-- 每行循环生成 5 个加工中心卡片 --> <div v-for="col in 5" :key="`${row}-${col}`" class="processing-card" @click="navigateToDetail((row - 1) * 5 + col)" @mouseenter="hoverCard = (row - 1) * 5 + col" @mouseleave="hoverCard = null" :class="{ 'card-hover': hoverCard === (row - 1) * 5 + col }" > <!-- 加工中心标题,根据行和列计算编号 --> <h3 class="card-title">加工中心{{ formatNumber((row-1)*5 + col) }}</h3> <div class="metrics"> <!-- 设备开动率指标 --> <div class="metric flex justify-between items-center" > <span class="label">设备开动率</span> <div class="progress-bar w-3/4" id="progress-outer"> <div class="progress" :style="{ width: equipmentPowerRateList[(row - 1) * 5 + col - 1], backgroundColor: getColor(equipmentPowerRateList[(row - 1) * 5 + col - 1]) }" > <!-- arrow --> <span class="arrow"></span> </div> <!-- 显示百分比文本 --> <span class="progress-text">{{ equipmentPowerRateList[(row - 1) * 5 + col - 1] }}</span> </div> </div> <!-- 性能指数指标 --> <div class="metric flex justify-between items-center"> <span class="label">性能指数</span> <div class="progress-bar w-3/4" id="progress-outer"> <div class="progress" :style="{ width: performanceIndexList[(row - 1) * 5 + col - 1], backgroundColor: getColor(performanceIndexList[(row - 1) * 5 + col - 1]) }" > <!-- arrow --> <span class="arrowt"></span> </div> <!-- 显示百分比文本 --> <span class="progress-text">{{ performanceIndexList[(row - 1) * 5 + col - 1] }}</span> </div> </div> <!-- OEE 指标 --> <div class="metric flex justify-between items-center"> <span class="label">OEE</span> <div class="progress-bar w-3/4" id="progress-outer"> <div class="progress" :style="{ width: oeeList[(row - 1) * 5 + col - 1], backgroundColor: getColor(oeeList[(row - 1) * 5 + col - 1]) }" > <!-- arrow --> <span class="arrow"></span> </div> <!-- 显示百分比文本 --> <span class="progress-text">{{ oeeList[(row - 1) * 5 + col - 1] }}</span> </div> </div> </div> </div> </div> </div> </div> </template> <script> export default { name: 'ProductionDashboard', name: 'App', data() { return { // 顶部信息 temperature: '23.5', currentTime: '18:53:39', currentDate: '2025年7月14日', // 菜单状态 activeMenu: '设备总览', activeWorkshop: '国合车间', workshops: ['国合车间', '大件车间', '小件车间'], // 默认选中第一个 activeWorkshop: 0 , activeButton: '设备总览' , // 设备开动率固定数值列表,按加工中心顺序排列 equipmentPowerRateList: [ '55%', '30%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%', '80%' ], // 性能指数固定数值列表,按加工中心顺序排列 performanceIndexList: [ '83%', '83%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%', '90%' ], // OEE 固定数值列表,按加工中心顺序排列 oeeList: [ '30%', '55%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%', '71%' ], hoverCard: null, // 记录当前悬停的卡片ID }; }, created() { // 初始化时间 this.updateDateTime(); setInterval(this.updateDateTime, 1000); }, methods: { // 更新时间 updateDateTime() { const now = new Date(); this.currentTime = now.toTimeString().split(' ')[0]; this.currentDate = `${now.getFullYear()}年${now.getMonth() + 1}月${now.getDate()}日 ${['日', '一', '二', '三', '四', '五', '六'][now.getDay()]} 星期`; }, selectWorkshop(index) { this.activeWorkshop = index; }, handleButtonClick(buttonName) { this.activeButton = buttonName; console.log(`点击了: ${buttonName}`); }, getColor(rate) { const percent = parseInt(rate); if (percent < 50) return '#C84D53'; // 红色 if (percent < 70) return '#C4A543'; // 橙色 return '#5CC352'; // 绿色 }, // 格式化数字为两位数(不足两位时前面补零) formatNumber(num) { return num.toString().padStart(2, '0'); }, navigateToDetail(machineId) { console.log(`跳转到加工中心${machineId}详情页`); // 实际项目中使用路由跳转: // this.$router.push({ name: 'MachineDetail', params: { id: machineId } }); }, } }; </script> <style scoped> /* 整体样式 */ .production-dashboard { background-color: #113231; color: white; min-height: 100vh; padding: 0px; min-width: 1200px; /* 设置页面最小宽度,超出屏幕时触发全局滚动 */ box-sizing: border-box; } /* 顶部导航(日期和页面切换) */ .top-bar { display: flex; justify-content: space-between; align-items: center; background: #003333; background: #003333 url('@/views/product/img/top-background.png') center/cover no-repeat; padding: 20px 10px; height: 40px; background-position: center; border-radius: 6px; } .weather-info { display: flex; gap: 15px; font-size: 10px; align-items: center; } .page-switch { gap: 50px; /* 调整页面切换按钮间距 */ font-size: 10px; } /* 标题区域 */ .title-section { margin-left: -100px; } .title { font-size: 17px; font-weight:700; margin-top: 15px; letter-spacing: 5px; background: linear-gradient(to right, #3eb2dc, #ffffff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-family: "Microsoft YaHei", sans-serif; /* 微软雅黑 */ } .button-container { display: flex; justify-content: space-between; margin: 15px 0; } .left-buttons, .right-buttons { display: flex; gap: 2px; margin-top: -18px; } .right-buttons{ margin-right: 150px; } .left-buttons{ margin-left: 150px; } /* 朝右的平行四边形按钮 */ .skew-button-right { position: relative; background-color: #3f7870; color: white; border: none; padding: 2px 2px; font-size: 8px; cursor: pointer; transform: skew(-15deg); /* 整体倾斜 */ transition: all 0.2s; margin-left: 0px; margin-right: 10px; width: 40px; height: 20px; box-shadow: 0 0 5px rgba(60, 175, 172, 0.5); } .skew-button-right:hover { background-color: #3cafac; } .skew-button-right span { display: inline-block; transform: skew(15deg); /* 文字反方向倾斜,恢复正常 */ } /* 朝左的平行四边形按钮 */ .skew-button-left { position: relative; background-color: #3f7870; color: white; border: none; padding: 2px 2px; font-size: 8px; cursor: pointer; transform: skew(15deg); /* 整体朝相反方向倾斜 */ transition: all 0.2s; margin-left: 10px; width: 40px; height: 20px; box-shadow: 0 0 5px rgba(60, 175, 172, 0.5); } .skew-button-left:hover { background-color: #3cafac; } .skew-button-left span { display: inline-block; transform: skew(-15deg); /* 文字反方向倾斜,恢复正常 */ } /* 选中状态样式 */ .skew-button-right.active, .skew-button-left.active { background-color: #3cafac; box-shadow: 0 0 5px rgba(60, 175, 172, 0.5); } .workshop-buttons { display: flex; justify-content: center; gap: 15px; /* 按钮间距 */ margin: -12px 0; } .workshop-btn { background: transparent; border: none; border-bottom: 2px solid transparent; /* 初始下边框透明 */ color: white; font-size: 10px; padding: 5px 10px; cursor: pointer; transition: all 0.3s; } .workshop-btn.active { border-bottom-color: #FF9900; /* 选中时下边框为橙色 */ color: #FF9900; /* 选中时文字为橙色 */ font-weight: 500; } .workshop-btn:hover:not(.active) { border-bottom-color: rgba(255, 153, 0, 0.5); /* 悬停时半透明橙色下边框 */ transition: border-color 0.3s; } .container { width: 600px; margin: 0 auto; padding: 20px; height: 100px; } .row { display: flex; flex-wrap: wrap; gap: 20px; } .card { flex: 1; min-width: 150px; display: flex; border: 1px solid #104D4E; border-radius: 8px; overflow: auto; box-shadow: 0 0 5px rgba(23, 103, 104, 0.845); } .card-left { width: 50%; /* 左侧占比 */ background-color: #003331; background-image: url(); height: 80px; } .card-right { width: 50%; /* 右侧占比 */ background-color: #003331; color: white; /* 文字默认白色 */ border-radius: 4px; padding: 5px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; } /* 行间距控制 */ .card-right p { margin: 7px 8px; /* 上下各5px距,确保三行分明 */ font-size: 10px; } /* 数字颜色样式 */ .red-number { color: #FF4949; /* 红色数字 */ margin-left: 5px; /* 与文字保持一点距离 */ } .green-number { color: #00CC00; /* 绿色数字 */ margin-left: 5px; } .yellow-number { color: #FF9900; /* 黄色数字 */ margin-left: 5px; } .app-container { display: flex; flex-direction: column; gap: 15px; padding: 20px; min-width: 1200px; max-height: 600px; margin: 0 auto; overflow-y: auto; } .card-row { display: flex; gap: 30px; overflow-x: auto; padding-bottom: 10px; margin: 0 auto; } .card-title { margin: 0 0 6px 0; font-size: 14px; font-weight: normal; } .metrics { display: flex; flex-direction: column; gap: 6px; } .metric { display: flex; align-items: center; justify-content: space-between; } .label { font-size: 10px; margin-bottom: 4px; width: 110px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; } .progress-bar { width: 100%; height: 12px; background-color: rgba(255, 255, 255, 0.1); border-radius: 6px; } .progress { height: 12px; transition: width 0.5s ease; display: flex; align-items: center; justify-content: flex-end; /* 让箭头在进度条内部靠右 */ padding-right: 4px; /* 给箭头和进度条边缘留间距 */ border-radius: 6px; } .progress-text { font-size: 9px; color: white; margin-left: 2px; /* 与进度条保持间距 */ } #progress-outer { display: flex; align-items: center; } .arrow { font-size: 10px; color: white; } .processing-card { flex: 0 0 180px; background-color: #0b3b3a; color: white; border-radius: 8px; padding: 12px; font-family: "宋体", SimSun, serif; transition: all 0.3s ease; /* 添加过渡效果 */ cursor: pointer; /* 鼠标指针样式 */ } /* 卡片悬浮效果 */ .card-hover { transform: translateY(-2px); /* 向上浮动 */ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* 阴影效果 */ background-color: #0e4c4b; /* 背景色变化 */ } </style> vue中左右滚动条不出现怎么办
07-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值