所以我在 HTML 中添加了一個影像,我想在它旁邊添加更多影像。但每次我嘗試時,它總是放在網路的下一行。我應該使用 CSS 嗎?我需要使用什么標簽或元素?
<!DOCTYPE>
<html>
<img src="imageone"/>
<img src="imagetwo"/>
<!-- i want "imageone" to be placed next to "imagetwo"-->
</html>
uj5u.com熱心網友回復:
將影像嵌套在父級中div并給它一個類。然后使用flex.
.wrapper {
display: flex;
justify-content: space-evenly;
margin: auto;
}
.wrapper img {
max-width: 100%;
}
<!DOCTYPE>
<html>
<div class="wrapper">
<img src="https://dummyimage.com/300/000/fff" />
<img src="https://dummyimage.com/300/000/fff" />
</div>
</html>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/441401.html
上一篇:使用JavaScript更改按鈕的類別和div的顯示
下一篇:如何洗掉表格中邊框之間的空白
