Why are unordered lists used for horizontal menus in HTML and CSS? -
why unordered lists used horizontal menus rather styling <a>
tags? have css, , works perfectly:
#menu { width: 700px; height: 40px; position: absolute; bottom: 0px; left: 50px; background-color: #00604f; border-radius: 10px 10px 0px 0px; box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5); text-align: center; overflow: hidden; } #menu { height: 20px; margin: 0px 5px; padding: 10px; display: inline-block; background-color: #0c61b4; color: #fff; text-decoration: none; } #menu a:hover, #menu a:active, #menu a.active { background-color: #07396a; } #menu a:active, #menu a.active { box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5) inset; }
the html this:
<div id="menu"> <a>hello</a> <a>world!</a> </div>
the <a>
tags can have whatever properties want (such href, onclick, etc.).
in reality, can use whatever elements want use. it's site after all.
the common argument using uls menu item object can contain link. contain sorts of things. might not have link @ if it's placeholder, or header. might place ul
inside it, , use css give drop down it.
in mind, link that. link. if doesn't navigate in way, shouldn't link. if menu items navigate, means use a
tag on ul
tags.
but might want think future proofing. sure link now, in future. applying styling links means rework later if have change how menu works. applying styling ul
s gives greater flexibility.
Comments
Post a Comment