CSS-如何定位内容数据标题
CSS - how to position content data-title
在我的jsfiddle中,我有11个图表,每个图表都有一个工具提示,显示悬停在图标元素上。但在有长标题文本的图表上,如果你向下滚动问题后面显示的示例,你可以看到,有很多文本的工具提示会跳出框。我想知道如何正确定位它,使它始终位于工具提示框内。
你可以在这里看到这个例子。
这是我的css文件:
@import "settings";
@import "foundation";
@include foundation-grid;
@include foundation-global-styles;
@include foundation-typography;
@include foundation-button;
@include foundation-forms;
@include foundation-visibility-classes;
@include foundation-float-classes;
@include foundation-breadcrumbs;
@include foundation-table;
html, body {
height: 100%;
}
// The grid is flex
body {
display: flex;
}
.content {
flex: 1;
}
section.article {
}
// .rows needs paddings in Panda
.row {
padding: 0.5rem 0;
}
// We override Zurb foundation breadcrumbs here
ul.breadcrumbs li.disabled {
color: $primary-color;
}
ul.breadcrumbs li a {
color: #0D47A1;
text-decoration: underline;
}
ul.breadcrumbs li.current a {
}
ul.breadcrumbs li:not(:last-child)::after {
color: #222;
content: ">";
}
// Default table styles are a bit large for big data sets
table {
font-size: .9rem;
}
// Panda button and link styles
a.tertiary {
background: none;
text-decoration: underline;
margin-left: 1.5rem;
}
// Special form styles where large datasets are presented
fieldset.bedrift {
.column {
margin: 0 0 1rem 0;
}
input {
margin: 0;
}
}
// Styles for reports
#graphs {
.row {
margin-bottom: 2rem;
}
.description p {
padding-top: 2rem;
font-size: 0.8rem;
}
}
#detaljer {
.row {
margin-bottom: 1.5rem;
}
h3 {
margin-bottom: 1rem;
}
td {
font-size: 0.8rem;
}
}
// Styles for the helper
#helper {
background: #ECEFF1;
float: right;
width: 50px;
height: 50px;
border-radius: 50%;
z-index: 1000;
&:hover {
background: darken(#ECEFF1,10);
transition: background 0.2s ease;
}
}
#list1, #list2 {
background-image: none;
}
//help tooltip
.has-tip{
position: relative;
}
.has-tip:after {
display: none;
left: 100px;
width:300px;
box-sizing: border-box;
font-size: .7em;
content: attr(data-title);
position: absolute;
background: rgba(249, 249, 249, 0.85098);
border: 1px solid rgb(124, 181, 236);
padding: 5px;
-webkit-transform: translate(-50%, 0%);
transform: translate(-50%, 0%);
z-index: 1000;
}
.has-tip:hover:after {
display: block;
z-index: 1000;
}
您的工具提示有一个固定的宽度300px,如果文本超过这个宽度,它将不适合。
修复此问题的最简单方法是将white-space: pre-wrap;
添加到CSS .has-tip:after
尝试删除宽度:300px;in。有提示:之后。它在小提琴中不能正常工作。或者添加空白:预包装;
相关文章:
- CSS-如何定位内容数据标题
- 数据描述、数据标题和SEO
- mvc4-jscript基于行数据多个值更改按钮标题
- 具有通用代码和唯一数据的HighGlobal配置&标题
- Highcharts-如何正确更新VUMeter的系列[0]数据和yAxis标题
- 如何在 React 中将 html 表单元格数据动态插入到具有动态标题的表中
- 对没有数据绑定“选项”或“标题”的选择列表进行挖空验证
- 如何将系列数据呈现为煎茶图表中的标题
- 数据表:如何将类设置为表行单元格(但不是表标题单元格!
- j查询数据表 导出按钮 动态文件名和标题
- 如何修复表的标题并允许数据垂直移动,同时允许标题和数据垂直移动
- jquery 数据表排序 表标题中的单击事件不在列标题文本中
- 通过单击任何单元格或表格数据及其左侧和顶部标题进行查找
- 如何防止数据表更新列标题文本
- LIghtBox2 数据标题描述链接与 JavaScript
- 如何使用jQuery选择数据标题中的元素
- 按钮工具提示的数据标题没有更新
- 从数据标题中删除内联样式表
- 设置灯箱中数据标题的格式
- 如何将数据标题从页面传递到fancybox表单元素