javascript - 在重叠的 div 周围环绕文本
问题描述
我的主 div 包含一些文本,还有 2 个其他 div,它们与主 div 重叠。但主 div 中的文本与其他 2 个 div 重叠。我希望主 div 中的文本环绕重叠的 div。
这个问题或代码可能很愚蠢,但请帮帮我。
.project1,
.project2 {
position: absolute;
background-color: #88c1dc;
width: 40%;
height: 50px;
z-index: 11;
border-radius: 10px;
}
.project1 {
top: 460px;
}
.project2 {
top: 540px;
}
.project_title_heading {
padding-top: 8px;
padding-left: 20px;
}
<section id="portfolio">
<div class="container" style="padding-top: 100px; height: 100vh; position: relative;">
<div class="portfolio" style="background: #2186B0; position: absolute; z-index: 10; left: 29%; padding: 30px; height: 80vh; border-radius: 20px;">
<p style="text-align: justify; font-weight: 500; font-size: 18px;">Lorem ipsum text here...</p>
</div>
<div class="project1">
<h3 class="project_title_heading"><a href="">Project 1</a>
</h3>
</div>
<div class="project2">
<h3 class="project_title_heading"><a href="">Project 2</a></h3>
</div>
</div>
</section>
解决方案
您是否尝试过将子 div 嵌入到主 div 中?试试下面:
<section id="portfolio">
<div class="container" style="padding-top: 100px; height: 100vh; position: relative;">
<div class="portfolio" style="background: #2186B0; position: absolute; z-index: 10; left: 29%; padding: 30px; height: 80vh; border-radius: 20px;">
<p style="text-align: justify; font-weight: 500; font-size: 18px;">Lorem ipsum text here...</p>
<!--New placement-->
<div class="project1">
<h3 class="project_title_heading"><a href="">Project 1</a></h3>
</div>
<div class="project2">
<h3 class="project_title_heading"><a href="">Project 2</a></h3>
</div>
<!--New placement-->
</div>
</div>
推荐阅读
- python - 保持numpy数组的内部值
- sql-server - 更改 MS Access 表中的数据类型产生错误消息
- python - 限制 systemd 服务访问文件
- python - 我在 Python 中不断收到 Django 的“ModuleNotFoundError”
- python - 有没有办法一次将多个视频文件转录成文本?
- python - 循环虽然我需要在开始时获取/添加0
- visual-studio-code - 如何根据文件名而不是vscode中的扩展名设置自定义图标?
- java - 使用 Java JSch“exec”与“shell”运行多个命令时性能受到影响?
- mysql - 使用 Mysql 打印板球比赛的积分表
- python - 如何在 IPython 和 Python 中运行异步函数