可以真正覆盖表的布局上的一切吗? [英] Can div really override table for everything on layouts?
问题描述
也许已经有一个关于这个主题的问题,但我找不到。
Maybe there is already a question about this subject, but I couldn't find it.
我的问题很简单,
在页面布局上只使用div?
My question is simple,
Can I use only divs on a page layout?
我有麻烦,例如创建一个带角的div。
I got myself in trouble to create a div with corners for example.
A_____B______C
| |
D E F
| |
G_____H______I
将所有字母作为div使用一些背景,而字母E是内容被放置,它是动态的,所以它可以获得任何高度,而宽度将是100%的整个窗口(有另一个div作为菜单左侧的div,但我没有在这里考虑)。< br>
在表中我真的很快没有hack,但是与divs我只是不能。
我不能使div D和F的高度正确扩展与divs,其余都是好的
take all letters as divs with some background, while letter E is where the content is placed, and it is dynamic, so it can get any height, while the width will be 100% for whole window(there is another div as the menu floating left of that div, but I didn't consider it here).
in table I did that really quick with no hack, but with divs I just couldn't.
I couldn't make the height of div D and F expand correctly with divs, the rest was ok
所以,
1.可以真正替换表格布局吗?
2.可以div替换表没有css兼容性?
so,
1. can div really replace tables for layout?
2. can div replace tables without css compatibility-hacks?
(btw,这不是我唯一的问题,div和css的布局,其中表很容易)
(btw, that wasn't my only problem with div and css for layouts where table did it easily)
谢谢,
Joe
Thanks,
Joe
推荐答案
您的示例完全可以在基本CSS中使用绝对定位定位元件。看看这个:
Your example is completely doable in basic CSS using absolute positioning inside relatively positioned element. Take a look at this:
在回答你的问题,divs真的替换表布局。
So, in answer to your question, divs really replace tables for layout.
问题二:应在需要表的位置使用表:表格数据。如果你需要在表中呈现东西,使用表。只是不要使用它们进行布局。
And what goes for question number two; tables should be used where tables are needed: in tabular data. If you need to present something in a table, use a table. Just don't use them for layout.
这篇关于可以真正覆盖表的布局上的一切吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!