Html 将图像居中,同时保留页脚
我一直在努力使图像居中(能够做到这一点),同时仍然有一个页脚会粘在页面底部 我似乎不知道如何在底部定位页脚,因为我定位图像的方式 这就是我所拥有的:Html 将图像居中,同时保留页脚,html,css,css-position,Html,Css,Css Position,我一直在努力使图像居中(能够做到这一点),同时仍然有一个页脚会粘在页面底部 我似乎不知道如何在底部定位页脚,因为我定位图像的方式 这就是我所拥有的: body { margin:0; padding:0; text-align:center; background-color:black; color: #463D38; } #Content { clear:both; width:500px; margin:0px auto;
body {
margin:0;
padding:0;
text-align:center;
background-color:black;
color: #463D38;
}
#Content {
clear:both;
width:500px;
margin:0px auto;
text-align:center;
padding:15px;
height:240px;
position:absolute;
top: 50%;
left: 50%;
}
#inner {
position: relative;
top: -50%;
left: -50%;
}
#text-center{
text-align:center;
font-family:Tahoma, Geneva, sans-serif
}
.footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #efefef;
text-align: center;
}
以下是页面的HTML代码:
<head>
<title>Title</title>
</head>
<body>
<div id="Content">
<div id="inner">
<img src="logo332.png" width="500" height="163">
</div>
<div class="footer">test</div>
</body>
</html>
标题
测试
关于如何让这两个人彼此友好相处,有什么建议吗
非常感谢 如果要粘贴页脚,则需要将其设置为位置:固定 如果要粘贴页脚,则需要将其设置为位置:固定;你能给我们看一下你的html代码吗?代码似乎没有错误。你能发布这张照片吗?使用相对定位,然后你可以正确地将图像居中并有一个粘性的页脚。添加html代码我已经添加了html(编辑了问题)。将在一秒钟内添加屏幕截图。