什么html标记用于显示标签/值数据? [英] What html markups to use for displaying label/value data?
问题描述
我想要呈现一个包含标签列表及其关联值的配置文件用户容器。
这里是我想要的信息和布局的摘录显示:
名字 ....... MyName
strong>年龄 ................... MyAge
电子邮件 ................ MyEmail
我知道有很多例子可用,但问题是,似乎有
到目前为止,我已经看到以下用法:
- 带标记的表格(和< tr>,< td> ...)
- ul> markup(and< li>,< div> ...)
- h1>,< h2> ...< p>
- DL>,< DT> DD>
- < 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 :
- Table with markup (and < tr >,< td >...)
- Unordered list with < ul > markup (and < li >, < div >...)
- Regular markups with < h1 >,< h2 >...< p >
- Definition List with < DL >, < DT > and < DD >
- < 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屋!