Luigi Tiburzi
Luigi Tiburzi

Reputation: 4325

Css layout, table or not

I need to implement a layout like that for a CSS:

picture: description
picture: description
   .
   .
   .
picture: description

I'm tempted of doing it something like:

<table>
       <tr>
            <td>picture</td>
            <td>description</td>
       </tr>
          .
          .
          .
</table>

But I've read that tables should be used only for strictly tabular data. My question is: is this the right case? If not, what would be a valid alternative?

Upvotes: 0

Views: 60

Answers (1)

user2578173
user2578173

Reputation:

You should use the new HTML5 elements for this as they are semantically rich.

figure and figcaption

This is how the mark up would look like in a website:

<figure>
    <img src="example.jpg" alt="example" />
    <figcaption>
      <p>This is the text I would use to describe the image</p>
    </figcaption>
</figure>

Here is the jsFiddle I used floats for position and widths for the layout, which always can be changed by you.

Upvotes: 1

Related Questions