当前位置:网站首页>一行简单的样式,让网页有「高级感」
一行简单的样式,让网页有「高级感」
2022-08-05 12:59:00 【InfoQ】
1. 问题:自己写网页样式,总是没「高级感」
举个例子

2. 寻找问题解决方案
box-shadow
header {
box-shadow: 0 2px 8px #f0f1f2;
}
3. 关于解决方案的思考:为什么加阴影后视觉体验变好了?
类比浏览器
4. 有哪些css可以实现阴影样式?
- box-shadow
- text-shadow
- filter里的drop-shadow
box-shadow
box-shadow: offset-x offset-y blur-radius spread color inset;
text-shadow
text-shadow: offset-x offset-y blur-radius color;
filter里的drop-shadow
filter: drop-shadow(offset-x offset-y blur-radius color);
5. 加了阴影后的效果
文章开头的例子

header {
box-shadow: 0 1px 6px rgb(0 0 0 / 10%);
}
img {
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
}
.text-shadow {
text-shadow: 0 2px 4px rgb(0 0 0 / 15%);
}
img:active {
box-shadow: 0 4px 8px -1px rgb(0 0 0 / 20%), 0 2px 6px -2px rgb(0 0 0 / 20%);
}
.text-shadow:active {
text-shadow: 0 3px 6px rgb(0 0 0 / 40%);
}
header作用在导航栏上,模糊距离大(6px),表明厚厚的导航栏放在了网页上。
img作用在所有图片上,且模糊距离小(3px),表明一张张薄薄的照片放在了网页上。如果你按下它,阴影会变更深。
.text-shadow作用在导航栏的主页按钮上、导航栏右上角的上、动态右下角的上,表明这些文字都放在了网页上,并且可以点击。如果你按下它,阴影会变更深。
为什么按下后(active态)阴影会变深?
建议
6. 写在最后
边栏推荐
猜你喜欢

【搜索框】通用测试用例

下单小程序怎么做呢?

买个社区团购小程序多少钱呢?微信社区团购小程序怎么做

HCIP--BGP小综合实验

做个小程序商城大约多少钱?哪些方面会影响价格?

Kuaike Electronics is listed on Shenzhen Stock Exchange: market value of 8.2 billion, annual revenue of 700 million and fundraising of 560 million

基于 nacos/灰度发布 实现减少本地启动微服务数量的实践

Easy to understand and play QT: QT program release packaging

选择商城小程序源码的三个技巧!

爱可可AI前沿推介(8.5)
随机推荐
2022 Huashu Cup C: Research on Performance Control of Intercalated Meltblown Nonwovens
leetcode 240. Search a 2D Matrix II 搜索二维矩阵 II(中等)
RT-Thread记录(二、RT-Thread内核启动流程 — 启动文件和源码分析)
小米Cyberdog源码开源啦!
solaris-磁盘管理
思岚S1激光雷达
LeetCode 623 Add a line to the binary tree [BFS DFS] HERODING's LeetCode road
VINS-Mono结果展示
Eolink使用教程
Should you migrate your monolithic architecture to microservices?
Dialogue with Zhuang Biaowei: The first lesson of open source
买个社区团购小程序多少钱呢?微信社区团购小程序怎么做
金融交易场景下热key如何解决
Shell script, help you improve the fishing time!
下单小程序怎么做呢?
Detailed analysis of the three cluster strategies of Redis
基于 nacos/灰度发布 实现减少本地启动微服务数量的实践
微信开发者工具更换默认用户存储目录方法,将C盘数据User Data迁移到D盘
配置了feign.hystrix.enabled:=true不生效的原因
树形dp CF461B Appleman and Tree