[CSS] Image replacement, text-indent, hover sprite,
CSS Text Image Hover sprite
2023-09-14 09:00:56 时间
.sidebar a { display: block; line-height: 40px; } .sidebar .featured, .sidebar .sales { background: url(sidebar.png) no-repeat; padding-left: 50px; } .sidebar .sales { background-position: 0 -80px; } .sidebar .featured:hover, .sidebar .featured:focus { background-position: 0 -40px; } .sidebar .sales:hover, .sidebar .sales:focus { background-position: 0 -120px; }
<!doctype html> <html lang="en"> <head> <title>Sven's Snowshoe Emporium</title> <link rel="stylesheet" href="style.css" /> </head> <body> <nav class="sidebar"> <ul> <li><a class="featured" href="#">Featured Items</a></li> <li><a class="sales" href="#">Sale Items</a></li> <li><a href="#">Men's</a></li> <li><a href="#">Women's</a></li> <li><a href="#">Children's</a></li> </ul> </nav> </body> </html>
相关文章
- 如何更愉快地使用rem —— 别说你懂CSS相对单位
- 前端每日实战:133# 视频演示如何用 CSS 和 GSAP 创作有多个关键帧的连续动画
- 可否控制<link type=text/css rel=stylesheet href=style.css>
- CSS魔法堂:你真的懂text-align吗?
- css两端对齐text-align: justify
- 一些上流的CSS3图片样式 | CSS | 前端观察
- [CSS] Use CSS Variables Almost like Boolean Values with Calc (maintainable css)
- [AngularJS] ngAnimate using css. 1
- [CSS] Image replacement, text-indent, hover sprite,
- 前端学习 -- Css -- 选择器的优先级
- [Angular 9] Custom CSS Variables binding
- CSS使用技巧
- CSS ID选择器与CLASS选择器
- 辛星与您使用CSS导航条