我的页面上有很多图像,我想在它旁边出现一些注释/注释/详细信息,说明图像悬停在任何特定图像上时的图像。
是餐厅项目。当有人在图像上盘旋时,它会显示菜肴文字说明。
我将如何实现这一目标?
(我正在处理类似于当你将鼠标悬停在此stackoverflow页面上的标签上时...)
body
{
}
/* Image Box Style */
#mainwrapper .box {
border: 5px solid #fff;
cursor: pointer;
height: 100px;
float: left;
margin: 5px;
position: relative;
overflow: hidden;
width: 100px;
-webkit-box-shadow: 1px 1px 1px 1px #ccc;
-moz-box-shadow: 1px 1px 1px 1px #ccc;
box-shadow: 1px 1px 1px 1px #ccc;
}
#mainwrapper .box img {
position: absolute;
left: 0;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
/* Caption Common Style */
#mainwrapper .box .caption {
background-color: rgba(0,0,0,0.8);
position: absolute;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
left: 0;
}
/** Caption 3: Fade **/
#mainwrapper .box .fade-caption
{
opacity: 0;
width: 100px;
height: 100px;
text-align: left;
padding: 0px;
}
/** Fade Caption :hover Behaviour **/
#mainwrapper .box:hover .fade-caption
{
opacity: 1;
}
<div id="mainwrapper">
<div id="box-3" class="box">
<asp:Image ID="Image1" CssClass="dishimg" runat="server" Width="100px" Height="100px" ImageUrl='<%# Bind("Image","~/Images/{0}") %>' />
<span class="caption fade-caption" >
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Comment") %>'></asp:Label>
</span>
</div>
答案 0 :(得分:0)
您可以在图片标记中使用title属性。在鼠标悬停时,将显示标题。例如:
<img src="smiley.gif" alt="Smiley face" width="42" height="42" title ='test'>