我正在建立我的第一个真正像样的网站基本上,我正在创建一个背景自动柜员机与一些css和一个图像,我想做它就像它在图片中

..。(已经完成了),但它不响应,可能是因为位置:绝对属性,我想让它正确响应。
下面是我用作后台的HTML代码
.bg {
background: #9359C7;
color: white;
display: grid;
text-align: center;
height: 764px;
width: 1280px;
}
.content {
position: relative;
}
.content img {
width: auto;
height: auto;
position: absolute;
right: -178px;
bottom: 0;
}Lol
编辑:我把我的整个网站都放在上面了patebin由于idk不允许我上传到这里,我得到的代码片段至少对我不起作用。
发布于 2021-02-25 20:55:25
这应该会起作用:
body {
font-family: sans-serif;
margin: 0;
padding: 0;
}
.hero {
position: relative;
overflow-x: hidden;
}
header {
position: relative;
background: black;
padding: 40px 0;
z-index: 5;
}
.content {
position: relative;
z-index: 5;
color: white;
text-align: center;
width: 70%;
height: 100vh;
max-height: 768px;
background: #9359C7;
padding: 20px;
}
img {
width: auto;
height: 98%;
position: absolute;
right: 30%;
bottom: 0;
transform: translateX(50%);
padding-top: 80px;
z-index: 10;
}
h1 {
margin: 0;
}Lol
https://stackoverflow.com/questions/66367646
复制相似问题