gpt4 book ai didi

html - 简单的 HTML/CSS 气泡聊天

转载 作者:太空宇宙 更新时间:2023-11-03 20:32:32 24 4
gpt4 key购买 nike

我想使用 CSS 进行简单的聊天。使用基本的 css(不是 CSS3),因为聊天在 IE 上运行并由 VB 程序加载。我使用左右浮动,但我遇到了像这张照片这样的问题 <code>enter image description here</code>

连续向左和向右冒泡。我想要的就像这张照片 enter image description here

这是我的示例代码

<div style="width:600px;">
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius</span>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
</div>
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The </span>
</div>
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius elements.</span>
</div>
</div>

最佳答案

用 clearfix 试试这段代码:

<div style="width:600px;">
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius</span>
<div style="clear: both"></div>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
<div style="clear: both"></div>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
<div style="clear: both"></div>
</div>
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius property allows you to add rounded corners to elements.</span>
<div style="clear: both"></div>
</div>
<div style="width:100%;">
<span style="background:#ff4d4d;padding:10px;float:right;margin-top:5px;">The </span>
<div style="clear: both"></div>
</div>
<div style="width:100%;">
<span style="background:#e5e5e5;padding:10px;float:left;margin-top:5px;">The border-radius elements.</span>
<div style="clear: both"></div>
</div>
</div>

关于html - 简单的 HTML/CSS 气泡聊天,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38915094/

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