简体   繁体   中英

html5: css styling: <ul> <li> vs <p> for column of links

There are 4 columns of links in the footer each of 25% of width. The css style of each column is the same (they belong to the same class). The first column looks like:

Title of Column 1

link11

link12

link13

I think it is possible to use <ul><li> tags or <p> tags to reach the goal. Which way is better, using <ul>, <li> or <p> ?

Added to the question: PSI've just checked the link http://www.w3schools.com/html5/tag_nav.asp , they use <!DOCTYPE html> (as I understand, html5), but if you check how they wrap the column of linke (my question), they just use <br/> instead of <p> or <li> (see the view source of the left column). Is using <br/> even better than <ul><li> or <p> ?

If you want to do it semantically correct, you would write the html according to your content. As you are displaying "a list of links", an "ul" is the way to go.

And (as a bonus) if you want to make it HTML5 compliant while you're at it, wrap the list in a "nav" tag.

<nav>
<ul>
<li><a href="#">link 1</a></li>
<li><a href="#">link 2</a></li>
<li><a href="#">link 3</a></li>
</ul>
</nav>

You should use both nav and ul tags to achieve this.

<nav>
    <h1>Title of Column 1</h1>
    <ul>
        <li>link11</li>
        <li>link12</li>
        <li>link13</li>
    </ul>
</nav>

我认为最好使用列表,并通过CSS使ul none成为list-style-type。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM