html - 放大时将文本放入容器
问题描述
我正在尝试建立一个响应式网站,一切都很好,除了那个云中的文字说“嘿!......”如下图所示当我不缩放时没关系我喜欢这种行为
但是当我放大时,我最终会遇到这种丑陋的行为
我不知道如何解决这个问题我试图将机器人图像的整个单元、说话的云和文本放在 a中div
,并将位置relative
应用于其中,div
并将位置absolute
应用于其中的所有项目,但它没有t工作,请任何解决方案,并提前谢谢你
这是我的代码:
.header-box {
width: 100vw;
height: 90vh;
background-color: #33cccc;
-webkit-clip-path: polygon(0 0, 100% 0%, 100% 76%, 0% 100%);
clip-path: polygon(0 0, 100% 0%, 100% 76%, 0% 100%);
position: relative;
}
.main-nav {
display: flex;
list-style-type: none;
justify-content: space-around;
width: 100vw;
text-align: right;
}
.main-nav__link {
text-decoration: none;
font-family: 'Roboto', sans-serif;
font-weight: bold;
color: #ffffcc;
}
.text {
font-family: Roboto;
font-weight: bold;
font-size: 20px;
color: #ffffcc;
height: 50vh;
display: flex;
align-items: center;
justify-content: center;
align-content: center;
}
.name {
font-size: 1rem;
display: block;
animation-name: moveInLeft;
animation-duration: 2s;
}
.vector-1{
position: relative;
height: 37vh;
}
.img-dialogue {
width: 60%;
position: absolute;
left: 20%;
bottom: 57%;
z-index: -1;
}
.dialogue {
font-family: Roboto;
color: #33cccc;
position: absolute;
top: 24px;
left: 55px;
display: inline-block;
}
.img-header {
width: 60%;
position: absolute;
bottom: 9px;
}
<div class="header-box">
<ul class="main-nav">
<li class="main-nav__items"><a class="main-nav__link" href="#">About</a></li>
<li class="main-nav__items"><a class="main-nav__link" href="#">Projects</a></li>
<li class="main-nav__items"><a class="main-nav__link" href="#">Contact</a></li>
</ul>
<div class="text">
<h1 class="big-heading"><span class="name">M.Amine Elwere</span> Front-end <br /> Web developer</h1>
</div>
<div class="vector-1">
<img src="../vector/Png for the web/header minou.png" data-aos="fade-up" class="img-header" alt="">
<img src="../vector/Png for the web/png-dialogue-2.png" data-aos="fade-right" data-aos-duration="4000" class="img-dialogue" alt="">
<h1 class="dialogue" data-aos="fade-up" data-aos-duration="5000">HEYY!...</h1>
</div>
</div>
解决方案
我认为您的问题源于缺少设置的字体大小。当浏览器渲染您的字体时,它会将其渲染为大致浏览器的大小。我建议,如果文本由您定位而不是图像,则使用值 vw 或 vh。这些对于响应式设计非常有用,并且由类似于百分比的浏览器大小启动。然后尝试使用 vw 或 vh 来调整你的字体大小和位置,你应该很好去!这是 CSS-Tricks 关于视口单元的文章 - https://css-tricks.com/fun-viewport-units/
推荐阅读
- c++ - 为什么这个解决方案比另一个解决方案快?
- google-sheets - 尝试使用 IF 或 IFS 公式解决工作问题
- linux - linux`shuf`--random-source中提到的随机字节是什么?
- ssl - 很多关于 http 的错误:TLS 握手错误来自
: :远程错误:tls:证书错误 - python - 来自值数组的 Сontour 图
- arrays - 试图将数据读入内存
- android - 通过二维码在手机上启动 Jitsi Meet 应用程序?
- mysql - VOIP 呼叫列表/文本文件中的所有号码
- django - 如何拦截和修改/更改 Django 请求 URL?
- c++ - 如何暂时禁用 clang-format 包括排序?