开发者

Is unordered list necessary on the following example?

开发者 https://www.devze.com 2023-01-20 00:36 出处:网络
As it\'s valid markup, I have done the following; <div class=\"list\"> <a href=\"#\">Link 1</a>

As it's valid markup, I have done the following;

<div class="list">                                    
            <a href="#">Link 1</a>
            <a href="#">Link 2</a>                
        </div>

My question is, does it have to be written as this;

<ul class="list">                                    开发者_如何转开发
            <li><a href="#">Login to Broker Site</a></li>
            <li><a href="#">Register</a></li>           
        </ul>

what are the + and - of doing one than the other? And are these both correct according to semantic web?

Thanks.


It totally depends on the greater context, but seeing as it seems to be a navigational sub-menu, a ul is indeed the most semantically correct element to use.


The clue is in the class name you chose.

As you see it as a list then use a list. This is a lot more semantic and is helpful for screen readers, which will then treat the contents as a list of links.

0

精彩评论

暂无评论...
验证码 换一张
取 消