编辑下面的代码:【加编码】
<html> <head> <style> ul { list-style-type:none; margin:0; padding:0; padding-top:6px; padding-bottom:6px; } li { display:inline; } a:link,a:visited { font-weight:bold; color:#FFFFFF; background-color:#98bf21; text-align:center; padding:6px; text-decoration:none; text-transform:uppercase; } a:hover,a:active { background-color:#7A991A; } </style> </head> <body> <ul> <li><a href="/demo/trycss_navbar_horizontal_advanced.htm#home">Home</a></li> <li><a href="/demo/trycss_navbar_horizontal_advanced.htm#news">News</a></li> <li><a href="/demo/trycss_navbar_horizontal_advanced.htm#contact">Contact</a></li> <li><a href="/demo/trycss_navbar_horizontal_advanced.htm#about">About</a></li> </ul> <p><b>Note:</b> If you only set the padding for a elements (and not ul), the links will go outside the ul element. Therefore, we have added a top and bottom padding for the ul element.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂