gpt4 book ai didi

jquery - 如何在段落 "without floating the div to right"旁边显示一个 div?

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

在下面的代码中,我希望 div #solution 显示在段落旁边,没有将#solution float 到右侧

原因是我不想将 #solution 对齐到屏幕的右侧,但我希望它是段落旁边。 这样包含答案的下拉列表应该“看起来像”问题陈述的内联部分或延续。

我怎样才能做到这一点?

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="statement" style="">
<div><p>Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement Question statement </p></div>
</div>
<div id="solution" style="">
<select class="answer">
<div><option value="">choose one</option></div>
<div class="r0">
<option id="q3:1_answer0" name="q3:1_answer" value="0">FirstOption</option>
</div>
<div class="r0">
<option id="q3:1_answer1" name="q3:1_answer" value="1">SecondOption</option>
</div>
<div class="r0">
<option id="q3:1_answer2" name="q3:1_answer" value="2">ThirdOption</option>
</div>
</select>
</div>
</body>

</html>

最佳答案

你可以使用table作为父div,table-cell作为子div。

显示:table-cell

<div style="display:table">
<div id="statement" style="display:table-cell">...</div>
<div id="solution" style="display:table-cell">...</div>
</div>

jsfiddle

关于jquery - 如何在段落 "without floating the div to right"旁边显示一个 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25108168/

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