【发布时间】:2015-03-27 07:35:16
【问题描述】:
我试图创造两件事:
- 在悬停时显示缩略图标题(淡入/淡出),带有 css,水平和垂直对齐。
- 在加载缩略图之前显示一个占位符(相同大小的缩略图)和加载程序(圆圈#aaa 颜色)。示例中的占位符颜色为#eee (lightgrey)
在小提琴的例子中,我给元素一些明亮的颜色,这样你就可以看到结构,蓝色、橙色、红色。浅灰色是我想用作占位符的颜色,标题应该在顶部。
第一个缩略图显示了我想要实现的操作,只是悬停时没有透明标题。
因为我使用的是假图像,它现在加载速度很快,但是当使用真实图像时,我想创建一个加载器,当缩略图完全加载时会淡出(所以缩略图加载在加载器下,加载器在顶部)我没有添加加载器在 html 代码中。
我希望有人了解我想要实现的目标并可以帮助我,对于代码专家来说一定很容易。
.caption {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 20px;
text-align: center;
vertical-align: middle;
opacity: 0;
visibility: hidden;
background-color: red; /*for test red*/
}
.thumb:hover .caption {
opacity: 1;
visibility: visible;
}
.loader {
position: absolute;
background-color: #aaa;
width: 18px;
height: 18px;
top: 50%;
left: 50%;
margin-top: -9px;
margin-left: -9px;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
z-index: 999;
}
【问题讨论】:
标签: html css hover loader caption