Html 关于边距和位置属性的CSS问题?
好的,我有这个代码:Html 关于边距和位置属性的CSS问题?,html,css,Html,Css,好的,我有这个代码: footer { background-color: #359DFF; text-align: right; text-decoration: overline; height: 50px; width: 100%; padding: 25px; margin: 0px; bottom: 0px; position: absolute; } 在本页上: 我正在为我的学校制作一个网页,但是页脚似乎不适合
footer {
background-color: #359DFF;
text-align: right;
text-decoration: overline;
height: 50px;
width: 100%;
padding: 25px;
margin: 0px;
bottom: 0px;
position: absolute;
}
在本页上:
我正在为我的学校制作一个网页,但是页脚似乎不适合页面,而且,在左侧,有一个缺口,这使得页脚看起来很难看,因为页面底部的边缘有一条白色条纹,不应该在那里
有没有办法解决这个问题,并在所有页面上自动调整宽度?宽度:100%对我不起作用。在车身样式中,添加
padding:0;
margin:0;
然后,对于页脚,改为删除右/左填充
padding:25px 0; /*This gives a top/bottom padding of 25px, and a left/right padding of 0.*/
此外,如果您对页脚执行
文本对齐:居中,效果会更好。首先,添加页脚填充时,您可以放大页脚填充,因此从页脚中删除填充并将其添加到页脚。
然后,您需要从页脚中删除高度50px。
对于最终触摸,将p边距设置为0;并将填充设置为:0 25px;
这将在所有浏览器中提供相同的外观,而不需要calc()和其他奇怪的css规则
下面是最干净的代码:
footer {
background-color: #359DFF;
text-align: right;
text-decoration: overline;
width: 100%;
margin: 0px;
bottom: 0px;
position: absolute;
}
footer p{
margin:0;
padding:0 25px;
}
您不需要额外的div来保存p。Firefox和Chromium都没有问题。
This Should work for you:
html, body{
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body{
margin: 0;padding:0; float:left; min-width:100%;
}
footer{
background-color: #359DFF;
text-align: right;
text-decoration: overline;
width: 100%;
margin: 0px;
bottom: 0px;
position: absolute;
}footer p{width: 95%;}