我试着理解绝对和相对的位置和价值,但我有一个问题。 为什么,当我使用"对"属性,我的" A"当分辨率改变时,点会改变位置,但是当它应用" left"属性,即使我改变分辨率,一切都保持良好状态?
代码: - 左:
html,
body {
background-color: #f4f4f4;
font-family: "Roboto", sans-serif;
}
body {
display: flex;
justify-content: center;
}
main {
background-color: #fefefe;
min-width: 350px;
max-width: 700px;
width: 40vw;
padding: 2rem;
}
.map {
background:url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Simple_world_map.svg/2000px-Simple_world_map.svg.png")
no-repeat;
background-size: cover;
height: 60vh;
position: relative;
}
.absolute {
position: absolute;
left: 100px;
top: 20px;
color: blue;
}

<main>
<form>
<div class="map">
<div class="absolute">
<h1>A</h1>
</div>
</div>
</form>
</main>
&#13;
html,
body {
background-color: #f4f4f4;
font-family: "Roboto", sans-serif;
}
body {
display: flex;
justify-content: center;
}
main {
background-color: #fefefe;
min-width: 350px;
max-width: 700px;
width: 40vw;
padding: 2rem;
}
.map {
background:url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Simple_world_map.svg/2000px-Simple_world_map.svg.png")
no-repeat;
background-size: cover;
height: 60vh;
position: relative;
}
.absolute {
position: absolute;
right: 447px;
top: 20px;
color: blue;
}
&#13;
<main>
<form>
<div class="map">
<div class="absolute">
<h1>A</h1>
</div>
</div>
</form>
</main>
&#13;
我的问题是为什么会发生这种情况,为什么使用&#34;对&#34;是如此不稳定?