/* Tooltip 基础样式 */ .tooltip-trigger { position: relative; display: inline-block; } .tooltip-container { position: absolute; visibility: hidden; opacity: 0; z-index: 9999; width: max-content; max-width: 320px; transition: opacity 0.3s ease, visibility 0.3s ease; pointer-events: none; overflow: visible; /* 确保容器不显示滚动条 */ } .tooltip-visible { visibility: visible; opacity: 1; pointer-events: auto; } .tooltip-content { position: relative; padding: 0.75rem 0.5rem 0.75rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem; line-height: 1.5; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); overflow: visible; /* 确保外层容器不显示滚动条 */ } .tooltip-content-inner { width: 100%; position: relative; } /* 可滚动的提示框内容样式 */ .tooltip-scrollable { overflow-y: auto; scrollbar-width: none; /* Firefox */ scrollbar-color: rgba(0, 0, 0, 0.3) transparent; /* 创建一个合适的内边距来容纳自定义滚动条 */ padding-right: 6px; } /* 隐藏默认滚动条 */ .tooltip-scrollable::-webkit-scrollbar { width: 3px; } .tooltip-scrollable::-webkit-scrollbar-track { background: transparent; } .tooltip-scrollable::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.2); border-radius: 3px; } .tooltip-scrollable:hover::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.3); } /* 深色主题滚动条样式 */ .tooltip-dark .tooltip-scrollable::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.2); } .tooltip-dark .tooltip-scrollable:hover::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.3); } .tooltip-dark .tooltip-scrollable { scrollbar-color: rgba(255, 255, 255, 0.3) transparent; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-style: solid; z-index: 1; } /* Tooltip 主题 */ .tooltip-dark .tooltip-content { background-color: #1e293b; color: #f1f5f9; } .tooltip-dark .tooltip-arrow { border-color: #1e293b; } .tooltip-light .tooltip-content { background-color: #ffffff; color: #334155; border: 1px solid #e2e8f0; } .tooltip-light .tooltip-arrow { border-color: #ffffff; } .tooltip-primary .tooltip-content { background-color: #2563eb; color: #ffffff; } .tooltip-primary .tooltip-arrow { border-color: #2563eb; } .tooltip-success .tooltip-content { background-color: #22c55e; color: #ffffff; } .tooltip-success .tooltip-arrow { border-color: #22c55e; } .tooltip-warning .tooltip-content { background-color: #f59e0b; color: #ffffff; } .tooltip-warning .tooltip-arrow { border-color: #f59e0b; } .tooltip-error .tooltip-content { background-color: #ef4444; color: #ffffff; } .tooltip-error .tooltip-arrow { border-color: #ef4444; } .tooltip-info .tooltip-content { background-color: #3b82f6; color: #ffffff; } .tooltip-info .tooltip-arrow { border-color: #3b82f6; } /* Tooltip 位置基本样式 - 根据箭头方向而不是容器位置 */ /* 箭头朝下 - 用于顶部提示框 */ .tooltip-arrow-bottom { border-width: 8px 8px 0 8px; border-color: inherit transparent transparent transparent; } /* 箭头朝上 - 用于底部提示框 */ .tooltip-arrow-top { border-width: 0 8px 8px 8px; border-color: transparent transparent inherit transparent; } /* 箭头朝右 - 用于左侧提示框 */ .tooltip-arrow-right { border-width: 8px 0 8px 8px; border-color: transparent transparent transparent inherit; } /* 箭头朝左 - 用于右侧提示框 */ .tooltip-arrow-left { border-width: 8px 8px 8px 0; border-color: transparent inherit transparent transparent; } /* 浅色主题下的箭头样式修正 */ .tooltip-light .tooltip-arrow-bottom { border-color: #ffffff transparent transparent transparent; } .tooltip-light .tooltip-arrow-top { border-color: transparent transparent #ffffff transparent; } .tooltip-light .tooltip-arrow-right { border-color: transparent transparent transparent #ffffff; } .tooltip-light .tooltip-arrow-left { border-color: transparent #ffffff transparent transparent; } /* 富文本提示框样式 */ .tooltip-rich .tooltip-content { padding: 0; overflow: hidden; } .tooltip-header { padding: 0.5rem 1rem; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.1); } .tooltip-body { padding: 0.75rem 1rem; max-height: inherit; overflow-y: inherit; } .tooltip-footer { padding: 0.5rem 1rem; background-color: rgba(0, 0, 0, 0.05); border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.75rem; text-align: right; } /* 深色主题特定样式调整 */ .tooltip-dark .tooltip-header { border-bottom-color: rgba(255, 255, 255, 0.1); } .tooltip-dark .tooltip-footer { background-color: rgba(255, 255, 255, 0.05); border-top-color: rgba(255, 255, 255, 0.1); } /* 浅色主题特定样式调整 */ .tooltip-light .tooltip-header { border-bottom-color: #e2e8f0; } .tooltip-light .tooltip-footer { background-color: #f8fafc; border-top-color: #e2e8f0; } /* 表格样式 */ .tooltip-content table { border-collapse: collapse; width: 100%; font-size: 0.75rem; } .tooltip-content table th, .tooltip-content table td { padding: 0.25rem 0.5rem; text-align: left; border-bottom: 1px solid rgba(0, 0, 0, 0.1); } .tooltip-content table th { font-weight: 600; background-color: rgba(0, 0, 0, 0.05); } .tooltip-content table tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.02); } /* 深色主题下的表格样式 */ .tooltip-dark .tooltip-content table th, .tooltip-dark .tooltip-content table td { border-bottom: 1px solid rgba(255, 255, 255, 0.1); } .tooltip-dark .tooltip-content table th { background-color: rgba(255, 255, 255, 0.1); } .tooltip-dark .tooltip-content table tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.05); } /* 动画效果 */ @keyframes tooltip-fade-in { from { opacity: 0; } to { opacity: 1; } } .tooltip-visible { animation: tooltip-fade-in 0.2s ease-out; } /* 自定义偏移类 */ .tooltip-custom-offset.tooltip-top { margin-top: 8px; /* 增加顶部边距 */ pointer-events: auto; /* 允许鼠标事件 */ } /* 延长鼠标移入tooltip的路径 */ .tooltip-custom-offset .tooltip-arrow { height: 12px; /* 增加箭头高度 */ pointer-events: auto; /* 允许鼠标事件 */ }