sách gpt4 ăn đã đi

javascript - 网页 |定心

In lại Tác giả: Walker 123 更新时间:2023-11-30 15:31:33 27 4
mua khóa gpt4 giày nike

我在使用 particles.js 时无法将图像居中。图像居中,但略微偏离中心。为什么要这样做,我如何才能将它居中?

html



<đầu>
particles.js demo









CSS

body {
margin: 0;
height: 2000px;
width: 100%;
}
::-webkit-scrollbar {
display: none;
}
#particles-js {
position: absolute;
width: 100%;
height: 100%;
background-color: #00a4ff;
background-image: url("../../../yHL4C4u.png");
background-repeat: no-repeat;
background-position: 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

#downarrow {
margin-left: 50%;
}
img {
position: absolute;
}

câu trả lời hay nhất

bạn đang sử dụng left: 50%; - 这会将图像的左边缘置于页面宽度的 50% 处。如果想让图片居中,添加transform: translateX(-50%);

body {
margin: 0;
height: 2000px;
width: 100%;
}

::-webkit-scrollbar {
display: none;
}

#particles-js {
position: absolute;
width: 100%;
height: 100%;
background-color: #00a4ff;
background-image: url("../../../yHL4C4u.png");
background-repeat: no-repeat;
background-position: 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

#downarrow {
margin-left: 50%;
}

img {
position: absolute;
}



关于javascript - 网页 |定心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42180821/

27 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress