html - Replicate Hackernoon url effect css
问题描述
New to html/css and would like to reproduce the effect here on urls. See the first url in the article "W3 Schools" which has an offset pale green bar and then goes solid on hover.
https://hackernoon.com/most-useful-sql-resources-f8q3254
An explanation of which properties do what would be appreciated. Thank you.
解决方案
您可以使用过渡和背景位置来做到这一点
strong:hover {
background-image: linear-gradient(transparent 0%, transparent calc(50% - 9px), rgb(0, 255, 0) calc(50% - 9px), rgb(0, 255, 0) 100%);
background-position: 0px 100%;
}
strong {
background-image: linear-gradient(transparent 0%, transparent calc(50% - 9px), rgba(0, 255, 0, 0.35) calc(50% - 9px),
rgba(0, 255, 0, 0.35) 100%);
transition: background-position 120ms ease-in-out 0s, padding 120ms ease-in-out 0s;
background-size: 100% 200%;
}
<strong>W3 Schools<strong>
推荐阅读
- mysql - MySQL:基于第 3 列中的值的不同行中 2 列的 AVG 差异(单独的表)
- javascript - 从 APK 和 IPA 应用程序(React Native 和/或 Expo)中删除 Javascript 包
- regex - 正则表达式最后一次出现
- assembly - 汇编部分 .code 和 .text 的行为不同
- php - 如何在php中创建一个与字符串具有相同值的数组
- javascript - 使用逗号解析未序列化的 JSON 对象数组
- sql-server - 选择按日期排序的每组的前 N 行
- windows - 如何在 cmake 中转义 nmake 命令行?
- azure-active-directory - 用户通过启用角色的安全组分配的 Exchange 管理员角色无法访问 EAC,但能够使用管理外壳
- gdb - 如何使用 gdb 的 Python API 迭代 `std::unordered_set` 中的元素?