html5 - Navigation List a:hover -
i'm creating website, , far has navigation bar under "construction." want when hover on it, whole nav ul li
background change color, not background behind text. have this:
<html> <head> <link href='http://fonts.googleapis.com/css?family=noto+sans' rel='stylesheet' type='text/css'> <title>landstown high school , technology academy - home</title> <link rel="stylesheet" type="text/css" href="main.css"> </head> <body> <header> <nav> <ul> <li class="active"><a href="#">home</a></li> <li><a href="#">contact us</a></li> <li><a href="#">sharepoint</a></li> <li><a href="#">employees</a></li> </ul> </nav> </header> <section class="body"> </body> </html>
and css:
body { margin: 0; padding: 0; font-family: 'noto sans', sans-serif; background: #f8f8f8 } /****header stuff****/ header { position: fixed; height: 10%; width: 200%; background: #f8f8f8; box-shadow: -10px 0px 10px #000; } nav { margin-right: 7%; margin-left: 7%; height: 40px; } nav a:hover { background: #00248f; } nav ul { width: 40%; background: #0033cc; line-height: 40px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } nav ul li { display: inline; padding: 8%; } nav ul li a:hover { text-decoration: none; } nav ul li { color: #f8f8f8; text-decoration: none; } nav ul li a:visited { text-decoration: none; }
how can it?
try this: http://jsfiddle.net/3bbe2/2/. have modified code around.
new css:
body { margin: 0; padding: 0; font-family: 'noto sans', sans-serif; background: #f8f8f8 } /****header stuff****/ header { position: fixed; height: 10%; width: 200%; background: #f8f8f8; box-shadow: -10px 0px 10px #000; } nav { margin-right: 7%; margin-left: 7%; height: 40px; } nav ul a{ padding:3px 3px; } /* nav li a:hover { background: #00248f; } */ nav ul { width: 60%; background: #0033cc; line-height: 40px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } nav ul li { display: inline; padding: 8%; padding:5px 5px; padding:10px 12px 10px; } nav ul li:hover { background: #00248f; } nav ul li { color: #f8f8f8; text-decoration: none; } nav ul li a:visited { text-decoration: none; }
Comments
Post a Comment