如何使用纯css制作网站下拉菜单

一个良好的内部链接结构有助搜索引擎优化,他们将作为最好的通道,让用户从网站的任何一页中回到你的最重要的页面,也让搜索引擎蜘蛛很方便的索引收录。

所以,对SEO有好的CMS系统的下拉菜单构建不是使用Javascript、Flash、或JQuery。而是建立在使用CSS布局基础上的。

以下是从网上搜集的一个使用纯CSS制作的下拉导航菜单:

<style type=”text/css”><!–
.menu {
font-family: verdana, sans-serif;
width:750px;
position:relative;
font-size:0.85em;
padding-bottom:250px;
}
.menu ul {
padding:0;
margin:0;
list-style-type: none;
}
.menu ul li {
float:left;
position:relative;
}
.menu ul li a, .menu ul li a:visited {
display:block;
text-decoration:none;
color:#000;
width:139px;
height:3em;
color:#000;
border:1px solid #fff;
border-width:1px 1px 0 0;
background:#dfc184;
padding-left:10px;
line-height:3em;
}
* html .menu ul li a, .menu ul li a:visited {
width:149px;
w\idth:139px;
}
.menu ul li ul {
display: none;
}
table {
margin:-1px;
border-collapse:collapse;
font-size:1em;
}

/* specific to non IE browsers */
.menu ul li:hover a {
color:#fff;
background:#bd8d5e;
}
.menu ul li:hover ul {
display:block;
position:absolute;
top:3em;
margin-top:1px;
left:0;
width:150px;
}
.menu ul li:hover ul li ul {
display: none;
}
.menu ul li:hover ul li a {
display:block;
background:#faeec7;
color:#000;
height:auto;
line-height:1.2em;
padding:5px 10px;
width:129px
}
.menu ul li:hover ul li a.drop {
background:#c9c9a7 url(../../graphics/drop.gif) bottom right no-repeat;
}
.menu ul li:hover ul li a:hover {
background:#c9c9a7;
color:#000;
}
.menu ul li:hover ul li:hover ul {
display:block;
position:absolute;
left:150px;
top:0;
width:150px;
}
.menu ul li:hover ul li:hover ul.left {
left:-150px;
}

–></style><!–[if lte IE 6]>

<style type=”text/css”>
.menu ul li a:hover {
color:#fff;
background:#bd8d5e;
}
.menu ul li a:hover ul {
display:block;
position:absolute;
top:3em;
left:0;
background:#fff;
margin-top:0;
marg\in-top:1px;
}
.menu ul li a:hover ul li a {
display:block;
background:#dbe4ab;
color:#000;
height:auto;
line-height:1.5em;
padding:5px 10px;
width:150px;
w\idth:129px;
}
.menu ul li a:hover ul li a.drop {
background:#c9c9a7 url(../../graphics/drop.gif) bottom right no-repeat;
}
.menu ul li a:hover ul li a ul {
visibility:hidden;
position:absolute;
height:0;
width:0;
}
.menu ul li a:hover ul li a:hover {
background:#c9c9a7; color:#000;
}
.menu ul li a:hover ul li a:hover ul {
visibility:visible;
position:absolute;
top:0;
color:#000;
left:150px;
}
.menu ul li a:hover ul li a:hover ul.left {
left:-150px;
}

</style><![endif]–>
<div class=”menu”>
<ul>
<li><a class=”drop” href=”../menu/index.html”>DEMOS
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”The zero dollar ads page” href=”../menu/zero_dollars.html”>zero dollars advertising page</a></li>
<li><a title=”Wrapping text around images” href=”../menu/embed.html”>wrapping text around images</a></li>
<li><a title=”Styling forms” href=”../menu/form.html”>styled form</a></li>
<li><a title=”Removing active/focus borders” href=”../menu/nodots.html”>active focus</a></li>
<li><a class=”drop” title=”Hover/click with no active/focus borders” href=”../menu/hover_click.html”>hover/click with no borders
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”Styling forms” href=”../menu/form.html”>styled form</a></li>
<li><a title=”Removing active/focus borders” href=”../menu/nodots.html”>removing active/focus borders</a></li>
<li><a title=”Hover/click with no active/focus borders” href=”../menu/hover_click.html”>hover/click</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
<li class=”upone”><a title=”Multi-position drop shadow” href=”../menu/shadow_boxing.html”>shadow boxing</a></li>
<li><a title=”Image Map for detailed information” href=”../menu/old_master.html”>image map for detailed information</a></li>
<li><a title=”fun with background images” href=”../menu/bodies.html”>fun with background images</a></li>
<li><a title=”fade-out scrolling” href=”../menu/fade_scroll.html”>fade scrolling</a></li>
<li><a title=”em size images compared” href=”../menu/em_images.html”>em image sizes compared</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
<li><a href=”../boxes/index.html”>BOXES
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”a coded list of spies” href=”spies.html”>a coded list of spies</a></li>
<li><a title=”a horizontal vertical menu” href=”vertical.html”>vertical menu</a></li>
<li><a title=”an enlarging unordered list” href=”expand.html”>enlarging unordered list</a></li>
<li><a title=”an unordered list with link images” href=”enlarge.html”>link images</a></li>
<li><a title=”non-rectangular links” href=”cross.html”>non-rectangular</a></li>
<li><a title=”jigsaw links” href=”jigsaw.html”>jigsaw links</a></li>
<li><a title=”circular links” href=”circles.html”>circular links</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
<li><a href=”../mozilla/index.html”>MOZILLA
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”A drop down menu” href=”../mozilla/dropdown.html”>drop down menu</a></li>
<li><a title=”A cascading menu” href=”../mozilla/cascade.html”>cascading menu</a></li>
<li><a title=”Using content:” href=”../mozilla/content.html”>content:</a></li>
<li><a title=”:hover applied to a div” href=”../mozilla/moxbox.html”>mozzie box</a></li>
<li><a title=”I can build a rainbow” href=”../mozilla/rainbow.html”>I can build a rainbow with transparent borders</a></li>
<li><a title=”Snooker cue” href=”../mozilla/snooker.html”>a snooker cue using border art</a></li>
<li><a title=”Target Practise” href=”../mozilla/target.html”>target practise</a></li>
<li><a title=”Two tone headings” href=”../mozilla/splittext.html”>two tone headings</a></li>
<li><a title=”Shadow text” href=”../mozilla/shadow_text.html”>shadow text</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
<li><a href=”../ie/index.html”>EXPLORER
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”Example one” href=”../ie/exampleone.html”>the first example for Internet Explorer</a></li>
<li><a title=”Weft fonts” href=”../ie/weft.html”>weft fonts</a></li>
<li><a title=”Vertical align” href=”../ie/exampletwo.html”>vertically aligning text</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
<li><a href=”../opacity/index.html”>OPACITY
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul>
<li><a title=”colour wheel” href=”../opacity/colours.html”>a colour wheel using opaque colours</a></li>
<li><a title=”a menu using opacity” href=”../opacity/picturemenu.html”>a menu using opacity</a></li>
<li><a title=”partial opacity” href=”../opacity/png.html”>partial opacity</a></li>
<li><a title=”partial opacity II” href=”../opacity/png2.html”>partial opacity II</a></li>
<li><a class=”drop” title=”Hover/click with no active/focus borders” href=”../menu/hover_click.html”>HOVER/CLICK
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<table>
<tbody>
<tr>
<td>
<ul class=”left”>
<li><a title=”Styling forms” href=”../menu/form.html”>styled form</a></li>
<li><a title=”Removing active/focus borders” href=”../menu/nodots.html”>removing active/focus borders</a></li>
<li><a title=”Hover/click with no active/focus borders” href=”../menu/hover_click.html”>hover/click</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!–[if lte IE 6]>
</a>
<![endif]–></li>
</ul>
</div>

Copyright © All Rights Reserved · Proudly powered by WordPress 冀ICP备12019045号-1

css.php