html - 在 chrome[html] 中使用 z-index 将字体稍微放在另一个字体之上?
问题描述
.a {
font-family: "Itim", cursive;
z-index: 1;
}
.b {
font-family: "Sedgwick Ave", cursive;
margin-bottom: 50px;
}
<link href="https://fonts.googleapis.com/css?family=Itim|Sedgwick+Ave" rel="stylesheet">
<p class="a">Back Font</p>
<p class="b">Front Font</p>
我得到了我想要的字体,但margin-bottom: 50px
没有达到我想要的效果,这种效果是将 b 类放在类 a 之上,使其看起来(有点)像 3D 文本。
解决方案
您可能想使用text-shadow
:
h1 {
font-family: Lobster;
font-size: 4.2rem;
text-shadow: 0 0 1px rgba(0,0,0,.27),.1em .2em 7px #bbb;
color: white;
margin: 0;
}
h1 span {
color: #c33;
}
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<h1>Use text shadow, <span>don't clone</span> your HTML!</h1>
推荐阅读
- javascript - JavaScript 从 Array.forEach 返回或中断
- image - 移动 Chrome 忽略响应式图像
- java - Thymeleaf 模板无法访问,是我的配置文件吗?
- css - Prepros 是否应该在 Github.io 页面上将我的 SASS 编译为 CSS?如果是这样,是什么导致我的 SASS 样式在 Github.io 页面上不起作用?
- javascript - 如何在ember中查看哪个组件调用了处理程序?
- javascript - 在 img src 上反应将导入名称作为道具传递为字符串
- php - 在 HTML 锚点 href 中使用 $_SESSION 的问题
- html - Chrome 元素检查器与实际渲染的元素不对齐
- javascript - 可以暂时冻结 HTML 元素的当前外观吗?
- c - 'u' 与整数有什么用