鼠标放上去,div高度随文字增加,并显示剩余的文字。

/*这里是鼠标放上去显示全名   */
    .kb2wText{display:block; height:20px; width:150px; line-height:20px; color:#000000; overflow:hidden;}
    .kb2wText:hover { width:100%; overflow:visible;height:auto; z-index:99;background-color:#F9F9F9;word-break:break-all;}

 

<div class="kb2wText">哈哈哈哈哈哈哈哈哈呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵</div>

转载于:https://www.cnblogs.com/wangxiangstudy/p/4828773.html

这段代码中,页面顶部正中间的位置,加一个隐藏的悬浮按钮,鼠标移动上去的时候显示,按钮的效果是,点击后,隐藏导航栏和标题栏,再次点击则显示,, 导航栏和标题栏显示的隐藏时,不要瞬间完成,有个动画效果,以下为代码<template> <div class="app-container"> <!-- 导航标题 --> <div class="nav-header"> <h3>iiot</h3> </div> <!-- 主布局 --> <div class="main-layout"> <!-- 左侧导航栏 --> <div class="left-nav"> <el-menu class="custom-menu" :collapse="false" background-color="#1a2b4a" text-color="#d7e3ff" active-text-color="#409EFF" :unique-opened="true" router > <el-sub-menu index="1"> <template #title> <el-icon><Document /></el-icon> <span>任务管理</span> </template> <el-menu-item-group> <el-menu-item index="/taskList">调度任务</el-menu-item> <el-menu-item index="/taskType">任务编辑</el-menu-item> <el-menu-item index="/commandSet">指令编辑</el-menu-item> <el-menu-item index="/log-types">任务日志</el-menu-item> </el-menu-item-group> </el-sub-menu> <el-sub-menu index="2"> <template #title> <el-icon><Files /></el-icon> <span>大屏展示</span> </template> <el-menu-item-group> <el-menu-item index="/display_all">总览</el-menu-item> <el-menu-item index="/warehouse_status">仓库状态</el-menu-item> </el-menu-item-group> </el-sub-menu> <el-sub-menu index="3"> <template #title> <el-icon><Notebook /></el-icon> <span>库位管理</span> </template> <el-menu-item-group> <el-menu-item index="/warehouse">库位管理</el-menu-item> <el-menu-item index="/station">站点管理</el-menu-item> </el-menu-item-group> </el-sub-menu> <el-sub-menu index="4"> <template #title> <el-icon><Setting /></el-icon> <span>配置模块</span> </template> <el-menu-item-group> <el-menu-item index="4-1">设备管理</el-menu-item> <el-menu-item index="4-2">量管理</el-menu-item> <el-menu-item index="4-5">路径管理</el-menu-item> <el-menu-item index="4-6">管控区域</el-menu-item> </el-menu-item-group> </el-sub-menu> </el-menu> </div> <!-- 右侧内容区 --> <div class="right-content"> <router-view> </router-view> </div> </div> </div> </template> <script lang="ts" setup> import { Document, Notebook, Files, Setting } from "@element-plus/icons-vue"; </script> <style> /* 全局样式重置 */ body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; } /* 确保所有元素使用border-box */ *, *::before, *::after { box-sizing: border-box; } </style> <style scoped> .app-container { width: 100vw; height: 100vh; margin: 0; padding: 0; display: flex; flex-direction: column; background-color: #ffffff; overflow: hidden; } .nav-header { padding: 12px 15px; display: flex; align-items: center; background-color: #152238; border-bottom: 0px solid #000000; flex-shrink: 0; } .left-nav { height: 100%; display: flex; flex-direction: column; width: 200px; /* 固定宽度 */ } .nav-header h3 { margin: 0; font-size: 22px; color: #d7e3ff; font-weight: 600; margin-left: 10px; } .main-layout { display: flex; flex: 1; overflow: hidden; min-width: 0; } .right-content { flex: 1; height: 100%; background-color: #f0f2f5; overflow: auto; padding: 0px; } .custom-menu { border-right: none; flex: 1; width: 100%; /* 占满容器 */ } /* 调整菜单项样式 */ .custom-menu .el-menu-item, .custom-menu .el-sub-menu__title { height: 50px; line-height: 50px; } /* 调整图标和文字的间距 */ .custom-menu .el-icon { margin-right: 8px; } </style>
最新发布
08-13
<template> <div class="admin-container"> <!-- 左侧导航栏 --> <nav class="sidebar"> <div class="logo">审计招投标管理系统</div> <ul class="menu-list"> <li> <router-link to="/admin/user" class="menu-item"> <el-icon><User /></el-icon> <span>用户管理</span> </router-link> </li> <li> <router-link to="/admin/tender" class="menu-item"> <el-icon><Document /></el-icon> <span>招标管理</span> </router-link> </li> <li> <router-link to="/admin/bid" class="menu-item"> <el-icon><Files /></el-icon> <span>投标管理</span> </router-link> </li> <li> <router-link to="/admin/project" class="menu-item"> <el-icon><Folder /></el-icon> <span>项目管理</span> </router-link> </li> <li> <router-link to="/admin/message" class="menu-item"> <el-icon><ChatDotRound /></el-icon> <span>消息管理</span> </router-link> </li> </ul> </nav> <!-- 右侧内容区域 --> <main class="content"> <RouterView/> </main> </div> </template> <script setup> //修改浏览器title import {onMounted} from "vue"; onMounted(()=>{document.title = '后台管理';}) import { User, Document, Files, Folder, ChatDotRound } from '@element-plus/icons-vue' </script> <style scoped> .admin-container { display: flex; min-height: 100vh; } .sidebar { width: 240px; background: #304156; color: #fff; } .logo { padding: 20px; font-size: 18px; font-weight: bold; text-align: center; border-bottom: 1px solid #263445; } .menu-list { padding: 20px 0; } .menu-item { display: flex; align-items: center; padding: 12px 20px; color: #bfcbd9; transition: all 0.3s; } .menu-item:hover { background: #263445; } .menu-item.router-link-active { background: #1890ff; color: #fff; } .menu-item .el-icon { margin-right: 8px; font-size: 18px; } .content { flex: 1; padding: 20px; background: #f0f2f5; } </style> 在顶部做空一行,这一行右边有个“管理员”鼠标移上去显示“退出登录
05-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值