作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在将页脚文本垂直(高度)居中时遇到了一些主要问题,我确实希望页脚更靠近段落文本。这可能吗? 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>
{
margin :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
关于html - css html 页脚问题是否可以解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54875526/
我是一名优秀的程序员,十分优秀!