当前位置:网站首页>一行简单的样式,让网页有「高级感」
一行简单的样式,让网页有「高级感」
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小综合实验

一夜成名的航班追踪网站,什么来头?

【Sequel Pro】下载查询结果乱码问题处理方式

运力升级助力算力流转,中国数字经济的加速时刻

Intronic Electronics IPO was terminated: annual revenue of 1 billion Shenzhen Venture Capital and Hongtu are shareholders

序章 调度系统架构设计总述

C进阶-数据的存储(下)

每秒10亿次更新、实现秒级同步延迟,腾讯深度学习推荐系统首次入选OSDI顶会

2022 Huashu Cup C: Research on Performance Control of Intercalated Meltblown Nonwovens

华为分析&联运活动,助您提升游戏总体付费
随机推荐
微信商城小程序怎么弄?怎么做微信商城小程序?
可编程直流电源用途广泛可以满足各种直流电源的应用场景
Detailed analysis of the three cluster strategies of Redis
运力升级助力算力流转,中国数字经济的加速时刻
solaris-oralce rac 安装
Horizon First Experience. Part 1
NFT卡牌游戏系统dapp开发NFT链游技术
js实现随机验证码(带干扰线)
安装pycocotools错误
C进阶 - 指针进阶
Bit rate vs. resolution, which one is more important?
express日志模块Morgan
TypeScript的崛起之路给我们带来的选谷思路
Mysql索引
shell脚本,帮你提升摸鱼时间!
炒股开户有什么要求吗?开户安全吗?
一致性协议-ChainPaxos详解
RT-Thread记录(二、RT-Thread内核启动流程 — 启动文件和源码分析)
[Share] Code programming habits: In the case of a multi-parameter method, the method needs to be sorted out - that is, the method with the most parameters is the main implementation
图扑软件数字孪生油气管道站,搭建油气运输管控平台