处理界面咏叹调间距的问题
在附图中,我想删除内容咏叹调左侧的空间,页面右侧也有相同的空间,界面的其余部分已经跨越整个宽度,但它没有跨越整个宽度。
如何在不影响界面上部的情况下跨越整个宽度?
我有以下 css 文件。
#logo {
left:13px;
top:-3px;
position:absolute;
z-index:2;
}
#heading {
height: 150px;
right: 0px;
left: 0px;
top: 0px;
margin-bottom: 5px;
background: #e8e8e8;
position:absolute;
z-index:0;
}
#upperMenu{
position:absolute;
height: 25px;
padding-top:2px;
right: 0px;
left: 0px;
top: 105px;
background: #e38217;
position:absolute;
z-index:1;
}
#content {
right: 0px;
left: 0px;
border: thin solid lightGray;
background: #F0F0F0;
margin-top:150px;
height:700px;
padding-bottom: 20px;
}
In the attached image, i want to remove the space of the left of content aria, same space is there on right side of page, remaining parts of interface have spanned over the whole width but it is not spanning over the whole width.
How can i span it on the whole width without disturbing the upper parts of interface?
I'm having the following css file.
#logo {
left:13px;
top:-3px;
position:absolute;
z-index:2;
}
#heading {
height: 150px;
right: 0px;
left: 0px;
top: 0px;
margin-bottom: 5px;
background: #e8e8e8;
position:absolute;
z-index:0;
}
#upperMenu{
position:absolute;
height: 25px;
padding-top:2px;
right: 0px;
left: 0px;
top: 105px;
background: #e38217;
position:absolute;
z-index:1;
}
#content {
right: 0px;
left: 0px;
border: thin solid lightGray;
background: #F0F0F0;
margin-top:150px;
height:700px;
padding-bottom: 20px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您只显示 CSS 而不是 HTML 时,很难给出准确的建议,但我会直接说您使用了太多绝对定位。您应该尽可能使用正常的文档流程,使用边距和填充来创建空间或将元素移开。有时您还需要浮动,通常,绝对定位将是最后的手段。
您还应该验证您的 CSS,因为您会遇到一些错误,例如为不是相对位置或绝对位置的元素指定左右值。
您还应该小心指定固定高度,而是让元素的内容决定它或其父元素的高度。如果指定固定高度并且内容太长,则内容要么溢出到框外,要么在父级上设置了 Overflow:hidden 时被隐藏。
It's hard to give accurate advice when you've only shown your CSS and not your HTML but I'd say straight off that you're using too much absolute positioning. You should be trying to work with the normal document flow wherever possible using margins and padding to create space or move elements away from each other. Sometimes you'll also need floats, and usually, absolute positioning will be the final resort.
You should also validate your CSS because you have a few errors like specifying right and left values for elements that aren't either position relative or absolute.
You should also be careful specifying fixed heights and instead let the content of an element dictate how high it or its parent should be. If you specify a fixed height and the content is too long, it'll either spill out of the box or be hidden if you've set overflow:hidden on the parent.