<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>搞代码-CSS便签样式效果-CSS应用实例(gaodaima.com)</title> <style> #mySidenav a { position: absolute; left: -80px; transition: 0.3s; padding: 15px; width: 100px; text-decoration: none; font-size: 20px; color: white; border-radius: 0 5px 5px 0; } #mySidenav a:hover { left: 0; } #about { top: 20px; background-color: #4CAF50; } #blog { top: 80px; background-color: #2196F3; } #projects { top: 140px; background-color: #f44336; } #contact { top: 200px; background-color: #555 } </style> </head> <body> <div id="mySidenav" class="sidenav"> <a href="#" id="about">About</a> <a href="#" id="blog">Blog</a> <a href="#" id="projects">Projects</a> <a href="#" id="contact">Contact</a> </div> <div style="margin-left:80px;"> <h2>便签效果</h2> <p>鼠标移动到指定便签显示隐藏内容。</p> </div> </body> </html>
本文案例为大家展示了《CSS便签样式效果》的代码,若要看代码效果请大家点击“运行代码”按钮。
[code]<!DOCTYPE html> <html> <head> <meta charset=”utf-8″> <title>搞代码-CSS便签样式效果-CSS应用实例(gaodaima.com)</title> <style> #mySidenav a { position: absolute; left: -80px; transition: 0.3s; padding: 15px; width: 100px; text-decoration: none; font-size: 20px; color: white; border-radius: 0 5px 5px 0; } #mySidenav a:hover { left: 0; } #about { top: 20px; background-color: #4CAF50; } #blog { top: 80px; background-color: #2196F3; } #projects { top: 140px; background-color: #f44336; } #contact { top: 200px; background-color: #555 } </style> </head> <body> <div id=”mySidenav” class=”sidenav”> <a href=”#” id=”about”>About</a> <a href=”#” id=”blog”>Blog</a> <a href=”#” id=”projects”>Projects</a> <a href=”#” id=”contact”>Contact</a> </div> <div style=”margin-left:80px;”> <h2>便签效果</h2> <p>鼠标移动到指定便签显示隐藏内容。</p> </div> </body> </html>[/code]