Below is the way showed on W3 tutorial, I curious what the difference to put CSS property: float in "li a" style but "li"? Why?
<!DOCTYPE html><html><head><title></title><style>
ul{list-style-type: none;padding:0px;margin:0px;overflow: hidden;background-color:#333333}
li{float: left;}
li a{display: block;padding:16px;color:#ffffff;text-decoration: none;text-align: center;float: block;}
li a:hover{background-color:#111111;}</style></head><body><h1>nvigation menu</h1><p>Use CCS to style the list horizonally, to create navigation menu</p><ul><li><ahref="deafalt.asp"target="_self">Home</a></li><li><ahref="deafalt.asp"target="_self">News</a></li><li><ahref="deafalt.asp"target="_self">Contact</a></li><li><ahref="deafalt.asp"target="_self">About</a></li></ul></body></html>
About styling a list horizontally to create a navigation menu
in HTML/XHTML
Posted
Below is the way showed on W3 tutorial, I curious what the difference to put CSS property: float in "li a" style but "li"? Why?