使用 CSS 重叠元素
cssweb developmentfront end technology更新于 2025/5/12 18:52:17
要重叠元素,请使用 CSS z-index 属性。您可以尝试运行以下代码来实现 z-index 属性,并将图像置于文本后面
示例
<!DOCTYPE html>
<html>
<head>
<style>
img {
position: absolute;
left: 0px;
top: 0px;
z-index: -1;
}
</style>
</head>
<body>
<img src = "https://www.cainiaomax.com/assets/videotutorials/courses/swift_4_online_training/380_course_210_image.jpg" width="300" height="250">
<p>This is demo text.</p>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

