我想使HTML中的文本位於圖像上方,並且不會覆蓋所有瀏覽器窗口。僅在圖像中定位文本,而不是在所有瀏覽器窗口中定位文本
我的HTML -
<div class="menu">
<img src="images\menu.png">
<div class="start-button">
<p><a href="index.html" style="text-decoration: none; color: white">Start</a></p>
</div>
</div>
我的CSS -
.menu {
position: relative;
text-align: center;
}
.menu .start-button {
position: absolute;
text-align: center;
top: 2%;
left: 2%;
}
所以,問題是 - 「頂:2%」 運作良好,但 「左:2%的」 不舒服。所以我的鏈接定位在瀏覽器窗口左側,而不是圖像。我如何解決這個問題?