开发者

I want to make my div float left behind the previous div

开发者 https://www.devze.com 2023-03-14 11:10 出处:网络
I have the following code: <div class=\"ans_chk\"> <input id=\"Answer_Response[3]\" name=\"Answer.Response[3]\" value=\"False\" type=\"checkbox\"

I have the following code:

<div class="ans_chk">
  <input id="Answer_Response[3]" name="Answer.Response[3]" value="False" type="checkbox"
</div>
<div style="font-weight: bold;" class="ans_opt" id="ans_opt_3">D)</div>
<d开发者_运维问答iv style="font-weight: 600;" class="ans_txt" id="ans_txt_3">xxx</div>
<div class="ans_exp" id="ans_exp_3"> - If message.</div>

But it's a problem because ans_exp_3 always goes to a new line if there are more than a certain number of characters.

Is there a way that I can make ans_exp_3 just tag along behind the text of ans_txt_3 ?


How about CSS to stop it wrapping.

.ans_exp {
    white-space:nowrap;
}

Or if you want the ans_exp_3 to be rendered next to the #ans_txt_3 you could float the #and_txt_3 with:

.ans_txt {
    float:left;
}

See demo.

0

精彩评论

暂无评论...
验证码 换一张
取 消