不占用生成图像的整个高度的渐变
Gradine that doesn't take entire height of generated image
我需要实现这个效果:(fucsia是透明的)
我想使用我准备实现的这个片段:
div {
width: 300px;
height: 100px;
background-image: url(http://lorempixel.com/300/100);
background-size: 0% 100%;
background-repeat: no-repeat;
background-position: center;
transition: background 2s ease;
}
div:hover {
background-size: 100% 100%;
}
代码笔:http://codepen.io/FezVrasta/pen/ByZqvK
我需要生成如下图所示的 CSS 渐变:(紫红色是透明的)
我该怎么办?
使用色标如下~:
div {
border:1px solid red;
width: 200px;
height: 100px ;
background-image: linear-gradient(to bottom,
transparent,
transparent 90%,
blue 90%,
blue)
}
<div></div>
你能用这样的东西吗?
.this {
width: 300px;
height: 100px;
background: red;
position: relative;
}
.this div {
position: absolute;
height: 10px;
width: 0px;
margin: 0 auto;
background: blue;
bottom: 0;
left: 50%;
transition: all 0.8s;
}
.this:hover div {
width: 100%;
left: 0;
}
<div class="this">
<div></div>
</div>
如果您想使用渐变创建这种类型的设计,您可以使用 this generator 来定义背景的 "a transparent" 部分
我需要实现这个效果:(fucsia是透明的)
我想使用我准备实现的这个片段:
div {
width: 300px;
height: 100px;
background-image: url(http://lorempixel.com/300/100);
background-size: 0% 100%;
background-repeat: no-repeat;
background-position: center;
transition: background 2s ease;
}
div:hover {
background-size: 100% 100%;
}
代码笔:http://codepen.io/FezVrasta/pen/ByZqvK
我需要生成如下图所示的 CSS 渐变:(紫红色是透明的)
我该怎么办?
使用色标如下~:
div {
border:1px solid red;
width: 200px;
height: 100px ;
background-image: linear-gradient(to bottom,
transparent,
transparent 90%,
blue 90%,
blue)
}
<div></div>
你能用这样的东西吗?
.this {
width: 300px;
height: 100px;
background: red;
position: relative;
}
.this div {
position: absolute;
height: 10px;
width: 0px;
margin: 0 auto;
background: blue;
bottom: 0;
left: 50%;
transition: all 0.8s;
}
.this:hover div {
width: 100%;
left: 0;
}
<div class="this">
<div></div>
</div>
如果您想使用渐变创建这种类型的设计,您可以使用 this generator 来定义背景的 "a transparent" 部分