html阴影颜色,CSS阴影颜色的继承

这篇博客介绍了如何使用CSS来创建卡片布局,并详细讲述了如何设置卡片的颜色、尺寸、内边距以及过渡效果。文章还展示了如何通过hover伪类改变元素大小并切换鼠标指针,以及利用伪元素创建模糊阴影,强调了阴影的流行趋势和实现方法。
摘要由CSDN通过智能技术生成

CSS

语言:

CSSSCSS

确定

.cards {

margin: auto;

padding: 1em;

background: white;

width: 640px;

}

/* Colors for the cards */

.red {

background: tomato;

}

.blue {

background: steelblue;

}

.purple {

background: mediumpurple;

}

.brown {

background: rosybrown;

}

/* Selecting the child elements by the tag name of "div"

this applies the styles to all divs */

.cards > div {

margin: 2em;

width: 250px;

height: 250px;

display: inline-block;

position: relative;

transition: transform 0.5s;

}

/* On hover it scales 1.2 times the original size

and changes the cursor to pointer */

.cards > div:hover {

transform: scale(1.2);

cursor: pointer;

}

/* This is the way to create those shadows

which are a trend now. Generally they are always

smaller in width than the parent elements */

.cards > div:after {

content: "";

background: inherit;

filter: blur(.9em);

opacity: 0;

height: 20%;

width: 70%;

position: absolute;

margin-left: auto;

margin-right: auto;

left: 0;

right: 0;

bottom: 0;

transition: opacity 1s, bottom 0.5s;

}

.cards > div:hover:after {

opacity: .8;

bottom: -1.2em;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值