头闻号

辽宁海城三洋化工厂

胺|通用有机试剂|酰胺|分析试剂|医药中间体

首页 > 新闻中心 > 科技常识:CSS导航栏及弹窗示例代码
科技常识:CSS导航栏及弹窗示例代码
发布时间:2023-02-01 10:10:10        浏览次数:6        返回列表

今天小编跟大家讲解下有关CSS导航栏及弹窗示例代码 ,相信小伙伴们对这个话题应该有所关注吧,小编也收集到了有关CSS导航栏及弹窗示例代码 的相关资料,希望小伙伴们看了有所帮助。

最近整理了CSS导航栏及弹窗 具体如下:

CSS导航

先来看下效果:

<!doctype html> <html> <head> <title>Insert your title</title> <meta charset="utf-8"> <style> body{ font-size:12px; } #discuss{ width:990px; margin:0 auto; } #mt{ height:30px; border:1px solid #ddd; border-top:2px solid #9d9d9d; background:#F7F7F7; } #discuss-content{ border-bottom:1px solid #ddd; padding-bottom:2px; } #discuss-datas{ width:990px; } #discuss-datas thead td{ font-weight:bold; padding:5px 0; border-bottom:1px solid #ddd; text-align:center; color:#666; } #discuss-datas td.col1{ width:620px; text-align:left; } #discuss-datas tbody td{ border-bottom:1px dotted #ddd; padding:5px 0; text-align:center; color:#9c9a9c; } #discuss a{ color:#005aa0; text-decoration:none; } #discuss a:hover{ text-decoration:underline; } #discuss-datas b{ padding-left:21px; padding-bottom:2px; padding-top:3px; background-image:url(../Images/iconlist_1.png); background-repeat:no-repeat; margin-right:5px; } b.shai{ background-position:-110px -220px; } b.lun{ background-position:-152px -220px; } #mt a{ float:left; width:100px; height:30px; text-align:center; line-height:30px; } #mt a.current{ border:1px solid #ddd; border-bottom:none; border-top:2px solid #E4393C; background-color:#fff; color:#E4393C; margin-top:-6px; height:35px; line-height:35px; } #extra p{margin:0;} #extra p.total{ float:right; } </style> </head> <body> <!-- 练习 --> <!-- #discuss : width:990px --> <div id="discuss"> <!-- 页签 #mt : height:30px; ,边框 背景 --> <div id="mt"> <a href="#">网友讨论圈</a> <a href="#" class="current">晒单帖</a> <a href="#">讨论帖</a> <a href="#">圈子帖</a> <a href="#">问答帖</a> </div> <!-- 内容 #discuss-content : 下边框 --> <div id="discuss-content"> <!-- 表格 --> <table id="discuss-datas"> <thead> <tr> <td class="col1">主题</td> <td>回复/浏览</td> <td>作者</td> <td>时间</td> </tr> </thead> <tbody> <tr> <td class="col1"> <b class="shai"></b> <a href="#"> 好大一瓶 不错 </a> </td> <td>0/0</td> <td> <a href="#">2001年冬天</a> </td> <td> 2011-11-11 11:11:11 </td> </tr> <tr> <td class="col1"> <b class="lun"></b> <a href="#"> 好大一瓶 不错 </a> </td> <td>0/0</td> <td> <a href="#">2001年冬天</a> </td> <td> 2011-11-11 11:11:11 </td> </tr> <tr> <td class="col1"> <b class="shai"></b> <a href="#"> 好大一瓶 不错 </a> </td> <td>0/0</td> <td> <a href="#">2001年冬天</a> </td> <td> 2011-11-11 11:11:11 </td> </tr> <tr> <td class="col1"> <b class="lun"></b> <a href="#"> 好大一瓶 不错 </a> </td> <td>0/0</td> <td> <a href="#">2001年冬天</a> </td> <td> 2011-11-11 11:11:11 </td> </tr> </tbody> </table> <!-- 其他内容(略) --> <div id="extra"> <p class="total"> 共900个话题 <a href="#">浏览全部话题</a> </p> <p class="new"> 有问题与其他用户讨论 <a href="#">[发表帖子]</a> </p> </div> </div> </div> </body> </html>

最后效果图:

商城导航:

<!doctype html> <html> <head> <title>Insert your title</title> <meta charset="utf-8"> <style> #nav{ width:990px; height:40px; background-color:#E64346; margin:0 auto; } #nav p{ margin:0; width:210px; height:40px; background-color:#CD2A2C; } #nav>p>a{ float:left; height:40px; line-height:40px; font-weight:bold; font-size:14px; color:#fff; text-decoration:none; padding-left:15px; } #nav>p>b{ float:right; width:20px; height:20px; background:url(../Images/iconlist_2.png) no-repeat -65px 0; margin:10px 10px 0 0; } #nav>p{ float:left; } #nav>ul{ float:left; margin:0; padding:0; list-style:none; } #nav>ul li{ float:left; } #nav>ul li a{ float:left; width:100px; height:40px; line-height:40px; text-align:center; font-size:14px; color:#fff; text-decoration:none; font-weight:bold; } #nav>ul li a:hover{ background-color:#BD2A2C; } #container{ width:990px; min-height:200px; margin:0 auto; } #cate_box{ margin:0; padding:0; list-style:none; width:210px; min-height:400px; background-color:#FAFAFA; border:2px solid #CD2A2C; border-top:none; box-sizing:border-box; padding-top:5px; } #cate_box>li{ padding:5px 0 5px 10px; width:196px; box-sizing:border-box; border-bottom:1px solid #fff; border-top:1px solid transparent; } #cate_box li:hover{ border-top-color:#ddd; border-bottom-color:#ddd; background-color:#fff; } #cate_box li>a{ color:#333; text-decoration:none; font-size:14px; } </style> </head> <body> <nav id="nav"> <p> <a href="#">全部商品分类</a> <b></b> </p> <ul> <li> <a href="#">首页</a> </li> <li> <a href="#">服装城</a> </li> <li> <a href="#">食品</a> </li> <li> <a href="#">团购</a> </li> <li> <a href="#">夺宝岛</a> </li> <li> <a href="#">闪购</a> </li> <li> <a href="#">金融</a> </li> </ul> </nav> <div id="container"> <ul id="cate_box"> <li> <a href="#">图书、音像、数字商品</a> </li> <li> <a href="#">家用电器</a> </li> </ul> </div> </body> </html>

导航列表弹框效果:

初始状态:

鼠标悬停时:

<!doctype html> <html> <head> <title>Insert your title</title> <meta charset="utf-8"> <style> #my_jd{ width:100px; height:30px; text-align:center; line-height:30px; border:1px solid #000; background-color:#fff; position:relative; cursor:pointer; } #menu{ width:400px; height:100px; background-color:#fff; border:1px solid #000; position:absolute; top:30px; left:-1px; display:none; } #my_jd:hover #menu{ display:block; } #my_jd:hover #line{ width:100px; position:absolute; border-top:1px solid #fff; } </style> </head> <body> <div id="my_jd"> 我的京东 <!-- 弹出菜单 --> <div id="menu"> 模拟我的京东弹出菜单 </div> <div id="line"></div> </div> </body> </html>

以上就是本文的全部内容 希望对大家的学习有所帮助 也希望大家多多支持爱蒂网。

来源:爱蒂网