html - Why it is accepted to use an UL, LI structure in menu lists? -
i'm new html. when started reading documentation lists, i've noticed everywhere <ul>
, <li>
structure used, creating simple lists.
but me it's comfortable use <a>
elements css:
display: block; /* and/or */ float: left;
so, why use <ul>
, <li>
instead of <a>
?
thanks lot.
because structurally they're appropriate elements purpose. helps screen reader users in terms of dictating elements of page.
remember html markup/content ( text? paragraph? wrap in p tag ), css styling, js behaviour.
you can have thousands of anchors on web page, if want style anchors nested within listed items differently other anchors?
<ul> <li><a href="#">blah</a></li> </ul> <a href="#">sfl</a>
if had done things properly, css trivial implement
a { } ul li { }
otherwise you'd have throw classes around anchors , messy , unstructural.
in regards seo - believe in past semantically marked code didn't have bearing nowadays specs rdf, html 5 elements web getting more , more semantic, it's beneficial semantic can be.
in 2010, google specified 3 forms of structured metadata systems use find structured semantic content within webpages. such information, when related reviews, people profiles, business listings, , events used google enhance 'snippet', or short piece of quoted text shown when page appears in search listings. google specifies that data may given using microdata, microformats or rdfa.[13] microdata specified inside itemtype , itemprop attributes added existing html elements; microformat keywords added inside class attributes discussed above; , rdfa relies on rel, typeof , property attributes added existing elements.[14]
Comments
Post a Comment