html - 调整大小时,文本不会在文本上保持固定
问题描述
我尝试将像素更改为百分比,我尝试将图像作为背景图像,但它仍然无法正常工作。在这一点上,我迷路了。此外,我正在使用一个我忘记包含的动画,它位于比例为 1.1 的“a”元素上;
预习 - https://codepen.io/jontabshi/pen/oNgVaqZ
HTML
<div class="button-contact">
<a href="#" alt="contact">
<img src="https://00.rc.xiniu.com/g1/M00/1E/4D/CgAGTF1BQzWALqT4AApMEzKQS6Y824.jpg" alt="contact button"/>
<h2>What are you waiting for?</h2>
<p>Many opportunities wait for you at Web Design and<br>Programming, get in touch now.</p>
</a>
CSS
/* Layout */
.button-contact {
padding-top: 50px;
display: grid;
justify-content: center;
}
.button-contact img:first-of-type {
max-width: 100%;
}
.button-contact h2,.button-contact p,.button-contact #white-button {
position: absolute;
}
.button-contact h2 {
bottom: 140px;
left: 360px;
}
.button-contact p {
bottom: 80px;
left: 363px;
}
#white-button {
right: 350px;
bottom: 125px;
}
/* Styles */
.button-contact img:first-of-type {
filter: brightness(40%);
-webkit-filter: brightness(40%);
}
.button-contact h2 {
font-family: Bebas, sans-serif;
color: white;
font-weight: 100;
font-size: 71px;
}
.button-contact p {
font-family: Roboto, sans-serif;
color: white;
font-weight: 100;
font-size: 25px;
}
请帮忙。我会很感激的。谢谢你。:)
解决方案
想通了它只是这个
.button-contact{
margin-left:auto;
margin-right:auto;
width:(picture width) px;
}
推荐阅读
- python - f-string: single '}' is not allowed Python SPARQL 查询问题
- javascript - 可以将相同的编码用于 HTML 属性和内容清理吗?
- google-slides - 使幻灯片编号不可编辑
- amazon-web-services - 在时间范围内达到 Redshift 表的查询数
- java - 无法在 @TestConfiguration 类中加载 ApplicationContext
- memory - 数字是否直接表示为位?
- python - 我的代码有问题,代理连接错误
- c++ - 为什么“iscntrl”返回 2?
- android - 来自服务器的 UserMessagingPlatform 无效响应
- c - 如何在c中将参数从子线程传递到孙线程