0
Navbar difference <a> the <ul> / <ol>
What is the difference between creating a navbar with <a> or <ul> / <ol> element, is that I see some using <ul> other <a> being able to create the same style I just gave an example in the navbar because I find it much easier and simpler to use <a> because when you use <ul> or <ol> you have to configure <li>, <a>, <ul> is it a matter of taste? or does it have differences?
8 Réponses
+ 2
I mean not using a list can save you five seconds yes but it's not the right way to approach things.
You want all your HTML to be understood by not only you looking at a smartphone, but also bots, blind people using a screen reader, reader mode in iOS and Android ( https://bit.ly/2HJWx7X ), ...
and for that it's important to write correct HTML. If you have a list of things, use a list :)
You get used to it quickly. Once your CSS files get hundreds of lines long, using good HTML also stops you from going insane. Like when you see `nav > ul > li > a { ... }` you immediately know what it does (and more importantly, what it does not do)
0
Adding <a> tags in a <ol> or <ul> is mainly a matter of taste but it has a slight difference.
When an <a> tag is inside of a <li> tag it will automatically give the <a> tag the same height and width as the <li>. So if you don't do this you will most likely notice that you can only click on the text, instead of the whole element you put the <a> inside of
Hope this helps. If this doesn't fully answer your question, please let me know. :)
0
Ghozzi Nassreddine you do not understand the question there is nothing
0
Stef Schöningh is not this my question, look she refers to when creating a navbar when we will customize many use the <a> element inside the div than having the job set up <ul>, <li>, <a>
0
As always in HTML, pick the most meaningful. If your navbar is a list of things, use <ul>. If it's an ordered list like the chapters of a book, use <ol>.
If the individual elements have links, use <a>.
Inside the CSS you can turn anything into anything really so HTML should be used to convey the right meaning.
0
Schindlabua yes I know but I see many use list to create navbar in the customization issue being that it would be easier to use link as element <a> do not you think?
0
Stef Schöningh is not that what I'm talking about, I'm going to give an example to understand what I mean: Example let's suppose I saw a guy create a navbar using list but I managed to do this customization without using list only using <a> because it uses list I find it very laborious because you have to customize <li> and <ul> or <ol> here comes my doubt is there anything special about doing this or is it a matter of liking each one doing his own thing?
0
Schindlabua thanks