css html 页脚问题是否可以解决?
Is the css html footer question possible to resolve?
我在将页脚文本垂直(高度)居中时遇到了一些主要问题,我确实希望页脚更靠近段落文本。这可能吗?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;
}
您可以在css中使用属性 "line-height"并将页脚的高度作为值
footer
{
height : 40px;
}
footer > p
{
line-height: 40px;
}
更多信息:
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
我在将页脚文本垂直(高度)居中时遇到了一些主要问题,我确实希望页脚更靠近段落文本。这可能吗?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;
}
您可以在css中使用属性 "line-height"并将页脚的高度作为值
footer
{
height : 40px;
}
footer > p
{
line-height: 40px;
}
更多信息: https://developer.mozilla.org/en-US/docs/Web/CSS/line-height