我无法验证并正常运行。
body {
background: #020817 url('');
background-repeat: no-repeat;
background-position: top center;
background-size: 100% auto;
body::after {
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
content: '';
}
}
我做了一些搜索,似乎无法找到我出错的地方。我正在尝试为背景图像添加渐变叠加。
答案 0 :(得分:1)
非常简单,你在身体选择器内部有身体::检查示例
body {
background: #020817 url('https://wallpaperscraft.com/image/google_search_logo_summer_drawing_26168_602x339.jpg');
background-repeat: no-repeat;
background-position: top center;
background-size: 100% auto;
}
body::after {
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
content: '';
}

希望我帮助你