问题描述
在每个CSS布局中添加 #container
, #Wrapper
中的整个代码是否有用?我们不能在没有这个额外的 div
的情况下进行布局?使用这个额外的 div
有什么利弊?
Is it useful to add whole code in #container
, #Wrapper
in every CSS layout? Can't we make layout without this extra div
? What are pros and cons to use this extra div
?
这是好的做法吗?它对任何类型的设计/布局有用吗?在语义上是否正确?
Is it good practice ? Is it useful for any type of design/layout? Is it semantically correct?
推荐答案
在每个布局中都不需要,除非每个布局都相同,需要一个包装/容器。
It would not be needed in every layout unless every layout was the same, and then only if they require a wrapper/container.
是的,有时可以省去额外的封装div。
Yes, you can sometimes dispense with the extra wrapper div.
这完全取决于你的布局。通常以固定宽度为中心的设计,包装器是最有意义的。您还可以设置 body
标记的样式,但是覆盖和其他元素可能看起来不同或不完全填充屏幕,具体取决于它们的实现。
It totally depends on your layout. Often with a fixed width centered design, a wrapper makes the most sense. You can also style the body
tag, but then overlays and other elements might look different or not totally fill the screen depending on their implementation.
是,但只有在布局需要时。
Yes, but only if the layout requires it.
宽度,居中布局。
真的不是 body
真的是一个非常好的容器
或 wrapper
所以添加另一个是多余的。然而,在许多设计中,这是一个必要的邪恶,这取决于所需的浏览器支持或所需的布局。如果对您的项目和布局有意义,请直接使用它。
Not really as the body
is really a perfectly good container
or wrapper
so adding another one is redundant. However, it is a necessary evil in many designs depending on browser support needed or the layout that is needed. Go ahead and use it without concern if it makes sense for your project and layout.
这篇关于它是有用的#container,#Wrapper在每个CSS布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!