什么html标记用于显示标签/值数据? [英] What html markups to use for displaying label/value data?

查看:108
本文介绍了什么html标记用于显示标签/值数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要呈现一个包含标签列表及其关联值的配置文件用户容器。



这里是我想要的信息和布局的摘录显示:



名字 ....... MyName



strong>年龄 ................... MyAge



电子邮件 ................ MyEmail



我知道有很多例子可用,但问题是,似乎有



到目前为止,我已经看到以下用法:


  1. 带标记的表格(和< tr>,< td> ...)

  2. ul> markup(and< li>,< div> ...)

  3. h1>,< h2> ...< p>

  4. DL>,< DT> DD>

  5. < label> ...?

语义上最正确的是什么?什么是最容易显示(在2列布局)?



(html / css代码段更受欢迎)

解决方案

哇。我们真的害怕大家都用表布局是邪恶的!使用CSS!的东西,不是吗?



一个表 - 与< th> < td> 的值 - 完全适用于这种内容,给你所需的渲染,并且至少作为语义正确的定义列表,可能更多。或者是优先于无语义的div。


I want to render a profile user container that contains a list of labels and their associated values.

Here is an excerpt of information and layout I'd like to display:

First Name.......MyName

Age...................MyAge

email................MyEmail

I know that there are tons of examples available but the problem is that it seems that there is no commonly accepted solution.

So far I have seen the following usage :

  1. Table with markup (and < tr >,< td >...)
  2. Unordered list with < ul > markup (and < li >, < div >...)
  3. Regular markups with < h1 >,< h2 >...< p >
  4. Definition List with < DL >, < DT > and < DD >
  5. < label >...?

What is the most semantically correct? What is the easiest to display (in a 2-columns layout)? What do you advise me to use and for what reasons?

(html/css code snippets are more than welcomed)

解决方案

Wow. We really have scared everyone off with the "Table layouts are evil! Use CSS!" stuff, haven't we?

A table — with <th> for the labels and <td> for the values — is perfectly applicable to this kind of content, gives you the rendering you want, and is at least as semantically correct as a definition list, arguably more so. Either are preferable to semantics-free divs.

这篇关于什么html标记用于显示标签/值数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆