当我将鼠标悬停在图像上时,我必须放大图像,它应该从 100x75 像素放大到 300x225 像素。布局似乎工作正常,只是宽度在悬停时没有按比例放大。先感谢您。图像的缩放比例不应超过 300x225 像素。
CSS:
.hoverbox a .preview {
display: none;
}
.hoverbox a .preview img {
display: inline;
}
.hoverbox a:hover .preview {
display: block;
position: absolute;
top: -1em;
left: -2em;
z-index: 10;
border-width: 1px 1px 6px 1px;
border-style: solid;
border-color: #fff7ea;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-moz-box-shadow: 2px 2px 2px #161615;
-webkit-box-shadow: 2px 2px 2px #161615;
box-shadow: 2px 2px 2px #161615;
}
.hoverbox img {
background: #fff;
border-width: 1px 1px 6px 1px;
border-style: solid;
border-color: #fff7ea;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-moz-box-shadow: 2px 2px 2px #161615;
-webkit-box-shadow: 2px 2px 2px #161615;
box-shadow: 2px 2px 2px #161615;
padding: 2px;
vertical-align: top;
width: 100px;
height: 75px;
}
.hoverbox li
{
background: transparent;
display: inline;
float: left;
margin: 3px;
padding: 5px;
position: relative;
}
.hoverbox .preview {
width: 300px;
height: 225px;
}
HTML:
<section>
<h1 class="headline">Feast your eyes.</h1>
<ul class="hoverbox">
<li>
<a href="#"><img src="200opt.jpg" alt="descr"/><img src="200opt.jpg" alt="description" class="preview" /></a>
</li>
</ul>
</section>
谢谢