如何解决CSS背景IMG

3qpi33ja  于 2022-12-15  发布在  其他
关注(0)|答案(4)|浏览(107)

我想在左触摸角需要这个背景IMG。这里是这个代码,我试图解决,但无法做到。

#Bg,img{
width: 150px;
margin: 0px;
padding: 0px;
float: left;
}

Img Hexa background for nav

mqxuamgl

mqxuamgl1#

请尝试使用此代码:

#Bg,img{
    position: absolute;
    left: 0%;
    bottom: 0%;
}
w7t8yxp5

w7t8yxp52#

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            height: 500px;
            width: 800px;
            margin: 0%;
            padding-top: 150px;
            float: left;
        }
    </style>
</head>

<body>

<img src="../IMG20210906184852-01.jpg" alt="">

</body>

</html>
wkyowqbh

wkyowqbh3#

或许试试“位置:绝对;”而不是“浮点:左;”

#Bg,img { 
top: 0% 
left: 0% 
position: absolute; 
}
63lcw9qa

63lcw9qa4#

我假设这是一个左上角的标志。如果你有一个通用的重置在顶部的CSS,当你添加你的图像到HTML,它应该显示在左上角。
* {margin: 0;padding: 0;box-sizing: border-box;}

相关问题