Hi, well this might b silly question but being a newbee i want to know
why we use UL tag for links like
cant we write it like
<div> home | about us |.............</div>
i think the above example ll save coding .as for "ul " , we ve to write code for div' id , ul , li , a , a:hover.
but for second example i ll write few code for div id,a and a:hover.
so wat is the advantage of it?
div is a non-semantic element - it doesn't mean anything in the context of page content. Using ul says "this is a list of links", which is basically what a menu is, and the vision-impared using screen readers can understand the structure. The other nice thing is that within a semantic structure there are 3 nested elements to attach styling to, greatly increasing the visual display possibilities.
Think of all the non-computer devices that can be used to access the page many of which don't have a display or possibly only a small one. With a list they can all process it as a list and make it accessible for the person to use it. With a div it is just text and the way that it is presented to them may be a jumbled mess especially if it reads out all the vertical bar text.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)