gpt4 book ai didi

html - 定位困难

转载 作者:太空宇宙 更新时间:2023-11-04 02:34:16 26 4
gpt4 key购买 nike

我试图定位两个图像并遇到困难。我想要“欢迎!”对话泡泡位于 Logo 的左侧。

有人可以帮我解决这个问题吗?

这是我的代码:

html {
background-color: #FFFFFF;
}

img {
width: 100px;
height: 150px;
}

#logo {
margin: auto;
width: 10%;
}

#welcome {
margin: auto;
width: 10%;
}

#popUp {
width: 50px;
height: 50px;
}
<! DOCTYPE html>
<html>
<head>
<title>Placehold</title>
<link rel="stylesheet" href="css/stylesheet.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<div id='logo'>
<img src="http://i1377.photobucket.com/albums/ah72/michaelbarley1/logo_zpsopheofmw.png" alt="logo">
</div>
<div id='welcome'>
<img id='popUp' src="http://i1377.photobucket.com/albums/ah72/michaelbarley1/welcome_zps3xaw6gge.png" alt="welcome">
</div>
</body>
</html>

最佳答案

一个简单的解决方法是切换 HTML 的顺序,使欢迎气泡 div 位于 Logo div 之前。然后,您所要做的就是将每个 div float 到左侧。

html {
background-color: #FFFFFF;
}

img {
width: 100px;
height: 150px;
}

#logo {
margin: auto;
width: 10%;
float:left;
}

#welcome {
margin: auto;
width: 10%;
float:left;
}

#popUp {
width: 50px;
height: 50px;
}
<! DOCTYPE html>
<html>
<head>
<title>Placehold</title>
<link rel="stylesheet" href="css/stylesheet.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<div id='welcome'>
<img id='popUp' src="http://i1377.photobucket.com/albums/ah72/michaelbarley1/welcome_zps3xaw6gge.png" alt="welcome">
</div>
<div id='logo'>
<img src="http://i1377.photobucket.com/albums/ah72/michaelbarley1/logo_zpsopheofmw.png" alt="logo">
</div>
</body>
</html>

关于html - 定位困难,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35991021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com