PHP 网页标签置底代码教程:使用 CSS 定位实现
<html>
<head>
<style>
/* 将页面底部的标签置于底部位置 */
#footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: #333;
color: #fff;
text-align: center;
padding: 10px;
}
</style>
</head>
<body>
<!-- 页面内容 -->
<div id="content">
<h1>网页标签置底示例</h1>
<p>这是一个示例网页,底部会有一个置底的标签。</p>
</div>
<!-- 页面底部的标签 -->
<div id="footer">
© 2021 My Website
</div>
</body>
</html>
<p>上面的代码中,我们使用了 CSS 中的 'position: fixed' 属性将底部的标签固定在页面底部。同时,设置了 'bottom: 0' 和 'width: 100%' 属性,使标签覆盖整个底部区域。在 HTML 中,我们通过 '<div>' 标签创建了两个容器,一个用于页面内容,一个用于底部标签。其中,底部标签的 ID 为 'footer',便于后续在 CSS 中进行样式设置。</p>
原文地址: https://www.cveoy.top/t/topic/m9kQ 著作权归作者所有。请勿转载和采集!