gpt4 book ai didi

html - 如何在 HTML/CSS 中将图像和文本放在另一个图像旁边?

转载 作者:行者123 更新时间:2023-11-28 10:26:01 26 4
gpt4 key购买 nike

我正在尝试将图像和文本放在另一个图像旁边。如果你想明白我的意思,请看这里:

7xecD

我试过使用 float 之类的东西,但它似乎不起作用。这是我的代码:

.left {float: left;}
.right{float: right;}

<div class="left">
<img src="img/image1.png" />
<p>Text</p>
</div>

<div class="right">
<img src="img/image2.png" />
</div>

最佳答案

这是你想要的吗?

<body>


<div id="Menu">
<img src="image"/>
<h4>Text</h4>


</div>


<div id="Container">
<h4>Content Section</h4>


</div>



body, html {
width:100%;
height:100%;
margin:0;
color:white;
}


#Menu {
background-color:black;
height:50%;
width:25%;
position:relative;
top:70px;
float:left;
}

#Container {
height:50%;
width:70%;
background-color:blue;
position:relative;
top:70px;
float:right;

}

关于html - 如何在 HTML/CSS 中将图像和文本放在另一个图像旁边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23723446/

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