我正在尝试使用 CSS 编写页脚,我需要在页面左下角显示一条消息,在右下角显示页码。这是我当前的代码。这两段没有正确显示:
<html>
<head>
<style>
.footer {
bottom: 0px;
position: fixed;
display: inline-block;
}
.left {
float: left;
}
.right{
float: right;
}
</style>
</head>
<body>
<div class="footer">
<p class="left">this is a footer</p>
<p class="right">Page: 1/12</p>
</div>
</body>
</html>
提前致谢!
从您的代码中删除反斜杠,它工作正常。我还为您的页脚添加了宽度 width: 100%;
<html>
<head>
<style>
.footer {
bottom: 0px;
position: fixed;
display: inline-block;
width: 100%;
}
.left {
float: left;
}
.right{
float: right;
}
</style>
</head>
<body>
<div class="footer">
<p class="left">this is a footer</p>
<p class="right">Pag: 1/12</p>
</div>
</body>
</html>
我是一名优秀的程序员,十分优秀!