图片不在绝对位置 div 内(使用 css 网格)
image does not remain within div with absolute position (using css grid)
我试图在 <div class="bg-image"></div>
中包含一个图像,在 div 中包含一个 header。但不幸的是 header 受到 class="bg-image"
不透明度的影响
我将 position:absolute;
添加到 class="bg-image"
这样我就可以将 header 从 div 内部移动到外部并且 header 将与图片。但是我的网站来自 How it should look to How it's not suppose to look
我的猜测是因为我正在使用 CSS 网格,宽度设置为 100% 有点搞砸了。我的问题是如何仅使用绝对定位将图像包含在 <div class="bg-image"></div>
中?
如果我没理解错,就把position: relative
加到.main-box
我试图在 <div class="bg-image"></div>
中包含一个图像,在 div 中包含一个 header。但不幸的是 header 受到 class="bg-image"
我将 position:absolute;
添加到 class="bg-image"
这样我就可以将 header 从 div 内部移动到外部并且 header 将与图片。但是我的网站来自 How it should look to How it's not suppose to look
我的猜测是因为我正在使用 CSS 网格,宽度设置为 100% 有点搞砸了。我的问题是如何仅使用绝对定位将图像包含在 <div class="bg-image"></div>
中?
如果我没理解错,就把position: relative
加到.main-box