使用UL代替DIVS - 推荐,在哪里使用1或其他? [英] Using UL in place of DIVS - recommended, where to use 1 or the other?

查看:129
本文介绍了使用UL代替DIVS - 推荐,在哪里使用1或其他?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所以ia位困惑,我应该什么时候使用divs和ul ..



例如,如果我有一个3列布局,那么我假设我在这里使用divs,虽然我可以使用UL



在右边的列上我有很多格式化,想法是把divs与divs在divs ...



在什么时候使用一个在另一个,是否有任何浏览器兼容性问题?



我看到一些网站说,ULs比divs更清洁,但是这种情况?



还有人说你可以用UL和LI建立一个完整的布局,但你永远不会这样做 - 为什么?



一个例子是,在我的第三列中, (右) - 它的一个div,但在内部,我需要放一个圆角的BOX,所以我想把更多的div在这里与角落的图像?



任何帮助将真的赞赏

解决方案

UL代表无序列表



DIV代表 division



ULs比divs --- IF 更清洁你正在做一个列表。菜单主要是链接列表。图库有一个图像列表。论坛有一个消息列表和一个用户列表。



RE:圆角:有HTML,并且有更多语义的 你可以使用< div> 任何东西,你几乎不会注意到差别,但使用适当的元素将使它更容易理解设计在一起,通过屏幕刮刮器试图在页面中找到适当的项目,以及足够智能的搜索引擎识别内容的片段和导航元素)。



为了做圆角,你应该考虑一个角落应该有自己的无内容的div(这可悲,由于今天的渲染引擎,它),或者如果你可以使用更好的解决方案(即,如果侧边栏是一个固定大小,你可以得到一个背景;如果你需要它在一个维度扩展,你可以使用两个:顶部对齐的天花板和底部对齐的地板在自己的移动div(理论上,你可以通过修改div的底部元素避免额外的div))。


been experimenting with unordered list UL and i have seem varios examples of using them in place of divs..

So i a bit confused, when should i use divs and ul..

for example if i have a 3 column layout then i presume i used divs here, although i can use UL

Also on the right column i have lots of formatting to do, the idea was to place divs with divs with in divs ...

can anyone point out when to use one over the other and are there any browser compatibility issues?

I have seen some sites say that ULs are cleaner than divs, but is this the case?

and also people stating you can build a complete layout with ULs and LIs but you would never do it - why?

I think you see where i am going with this, i am just confused about when to use one over the other.

One example is that in my 3rd column (right) - its a div but inside i need to put a rounded BOX so i was think of putting more divs inside this with corner images?

Any help would be really appreciated

解决方案

UL stands for unordered list. Use it for lists of items where order is irrelevant.

DIV stands for division. Use it to group items.

ULs are cleaner than divs---IF you're doing a list. A menu is mostly a list of links. A gallery has a list of images. A forum has a list of messages, and a list of users.

RE: rounded corners: There's HTML, and there's more semantical HTML. You could use <div> for anything, and you'd hardly note a difference, but using the proper elements will make it easier to understand (both by you when putting the design together, by screen-scrapers trying to find the proper item in the page, and sufficiently-smart search engines identifying fragments of content and navigation elements).

So, in order to do rounded corners, you should consider wether a corner deserves its own content-free div (which, sadly, due to today's rendering engines, it does), or if you can use a better solution (ie, if the sidebar is a fixed size, you can get by with a single background; if you need it to expand in one dimension, you can use two: a top-aligned ceiling, and a bottom-aligned floor on its own "mobile" div (theorically you could avoid the extra div by modifying the bottom element of the div)).

这篇关于使用UL代替DIVS - 推荐,在哪里使用1或其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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