我有5个包含悬停时发生变化的文本框。垂直对齐内容和2行文字
但是,如果一个箱子的“内容”有多条线路,它会将其他箱子轻微推下。
另外,如何垂直居中内容?行高确实是工作,但有些文本不止一行。另外垂直对齐似乎适用于整个DIV,而不仅仅是文字内容
.image {
width: 204px;
height: 204px;
background-image: url('imglink');
display: inline-block;
background-repeat: no-repeat;
margin-left: 22px;
margin-right: 22px;
font-family: "Verdana", Geneva, sans-serif;
color: white;
font-size: 11pt;
}
.image:hover{
cursor: pointer;
}
.image:after {
width: 204px;
height: 204px;
display: inline-block;
background-repeat: no-repeat;
/* Content is inserted */
content: 'This text is already there';
}
.image:hover:after{
background-image: url('/imglink');
cursor: pointer;
content: 'This text will appear on hover';
}
<div class="image">
</div>
这里的CSS,除了对不同内容的所有5盒相同。 有排序这是搜索在谷歌的“内容”并没有真正拿出CSS“内容”
这里巨大的困难是一个小提琴:https://jsfiddle.net/su8bytdc/7/
我不完全确定除了垂直对齐之外,你正在努力完成什么。你可以拨弄它吗? jsfiddle.net – Gacci
@Gacci是的这里是小提琴:https://jsfiddle.net/su8bytdc/7/。正如你所看到的,如果你将鼠标悬停在一个上面,其他人就会下来 –
尝试为'.image'定义'line-height:204px;'为 – Banzay