我试图复制与本网站相同的效果:http://www.knockknockfactory.com/
调整浏览器宽度大小后,图像会自动变小,但其所占区域的高度保持不变.
当我试图复制这个时,我的图像也会变小但高度会变化吗?
到目前为止我的代码是:
<div id="image"><img src="cover.png" /></div>
Run Code Online (Sandbox Code Playgroud)
CSS:
body {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
Run Code Online (Sandbox Code Playgroud)
如何在浏览器调整大小时减少/增加我的图像,但仍然使用CSS在该网站上保持相同的高度?
我正在学习如何制作 css3 动画。我怎样才能让这个盒子在它向下移动时淡入淡出?
示例:http : //jsfiddle.net/RtWTN/1/
<!DOCTYPE html>
<html>
<head>
<style>
div
{
width: 100px;
height: 100px;
background: red;
position: relative;
animation: mymove 3s ease-out forwards;
animation-iteration-count: 3;
}
@keyframes mymove
{
from { top: 0px;}
to { top: 200px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)