【发布时间】:2014-07-13 06:43:01
【问题描述】:
我正在尝试制作一种包含许多 DVD 封面的菜单。当光标位于每个封面上时,它将在一行中显示完整的标题名称(不包裹在封面容器内)。如何将每个封面的标题右对齐。
注意:我想把标题放在封面上方一点,而不是完全超过它。
这是 HTML 示例:
<div id="cover"><span>Here is the title in a single line!</span></div>
这是 CSS:
#cover{
height:200px;
width: 150px;
background-color:#00f;
margin-top:50px;
margin-left:auto;
margin-right:auto;
}
#cover span{
position:absolute;
background-color:#0f0;
display:none;
}
#cover:hover span{
display:block;
}
JSFIDDLE:example
【问题讨论】:
-
最容易解决问题。