【发布时间】:2019-02-26 06:33:19
【问题描述】:
我在将页脚文本垂直(高度)居中时遇到了一些主要问题,我确实希望页脚更接近段落文本。这可能吗?enter image description here
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="stylefooter.css">
</head>
<body>
<div id="container">
<div id="main">
<p>ffsdergserkghretkguhsritg</p></br>
</div>
</div>
<footer id="footer">
<p>Ohhhh yeah!</p>
</footer>
</body>
</html>
-
{
边距:0;
填充:0;html,正文 {
高度:100%;
}容器{
min-height: 100%;}
主要{
overflow: auto; padding-bottom: 40px;}
页脚{
background-color: black; position: relative; height: 40px; clear: both; text-align: center; color: white;}
【问题讨论】:
-
v-align:center工作吗? -
请create a Minimal, Complete, and Verifiable example,以便我们更好地为您提供帮助。
-
贴一些代码...
-
对不起,我是新手,今天的表格不开心。
-
解决了两部分问题的第二个问题。我设法(自己)将页脚移到更靠近顶部的位置。现在,是否可以将文本垂直居中?我试过 v-align 但它不起作用。