现在我在Magento 2上工作,我遇到了一个问题,当我在google chrome中调整大小时,按钮的背景图像不会保持不变。
.botones1 {
position: absolute;
left: 400px;
font-size: 22px;
color: white;
text-decoration: none;
font-weight: bold;
background-color: #357b2b !important;
}
.botones1:hover {
background-color: #9FCD4C !important;
}
.botones2{
position: absolute;
left: 796px;
font-size: 22px;
color: white;
text-decoration: none;
font-weight: bold;
background-color: #357b2b !important;
}
.botones2:hover {
background-color: #9FCD4C !important;
}<div class="container">
<img src="https://placeimg.com/1000/480/any" alt="Smiley face">
<a class="button botones1" href="#">Buy Coupon</a>
<a class="button botones2" href="#">Sell Coupon</a>
</div>
当我使用移动设备进入时,我想要背景图像,并且按钮的大小会以一种响应式的方式进行调整,并且我希望它们留在相同的位置。
谢谢。
发布于 2020-05-02 01:22:19
如果你想让你的页面具有响应性,你应该使用Flexbox & Grid来定位你的元素,而不是像素,因为它们会在很大程度上限制你。您可以尝试使用display:flex作为<div>,并在flex容器中排列元素(尝试使用Inspector)。
这里有一些关于flexbox的好东西:https://css-tricks.com/snippets/css/a-guide-to-flexbox/
https://stackoverflow.com/questions/61546015
复制相似问题