标准Xhtml- div vs li [英] standard Xhtml- div vs li

查看:179
本文介绍了标准Xhtml- div vs li的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在以下情况下的建议。
假设我有一个UI

I need ur suggestion in the following scenario. Lets say I have an UI something like

Col1 Col2
A    D
B    E
C    F

现在在HTML中我现在使用..like

Now to get this right now in my HTML I am using ..like

<div class="col1">
  <div>A</div> 
  <div>B</div>
  ..........
</div>
<div class="col2">
  <div>D</div> 
  <div>E</div>
  ..........
</div>

但这里我使用太多的div..is它确定按照标准XHTML或应该使用< li>

But here I am using too much div..is it OK as per standard XHTML or should I use <li>?

有人会建议正确的解释,
注意:不使用表格
感谢。

Can somebody suggest with proper explanation, or maybe something else? Note: No use of Table Thanks.

推荐答案

对我来说,你正在尝试显示表格数据,元素非常适合和是打算使用。

It looks to me like you are trying to display tabular data which the table element works great for and is the intended use.

<table>
  <tr>
    <th>Col1</th>
    <th>Col2</th>
  </tr>
  <tr>
    <td>A</td>
    <td>B</td>
  </tr>
</table>

如果你真的不想使用 table ,我将使用 div 元素,就像您在示例中所做的那样。但是最终你会意识到你要完成的是模拟一个已经存在的元素 - table

If you really don't want to use table, I'd use the div element like you did in your example. But in the end you will realize that what you are trying to accomplish is simulating an element that already exists - table.

您应该记住,当您使用 div 作为表格时,当您禁用CSS或使用旧版移动浏览器查看时, 't支持浮动很好)。

You should keep in mind that when you are using div as a table it won't look well when you disable CSS or viewing it with an older mobile browser (that don't support floats well).

这篇关于标准Xhtml- div vs li的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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