gpt4 book ai didi

css - 防止单选按钮下方的文本换行

转载 作者:技术小花猫 更新时间:2023-10-29 10:18:24 26 4
gpt4 key购买 nike

我可以用这张图片来描述我想要的东西的最佳方式:

如何使文本与顶部文本而不是单选按钮对齐?

相关CSS如下:

.basic-grey {
width: 600px;
margin-right: auto;
margin-left: auto;
background: #FFF;
word-wrap: break-word;
padding: 20px 30px 20px 30px;
font: 12px "Myriad Pro", sans-serif;
color: #888;
text-shadow: 1px 1px 1px #FFF;
border:1px solid #DADADA;
}

}
.basic-grey h1>span {
display: block;
font-size: 11px;
}
.basic-grey label {
display: block;
margin: 0px 0px 5px;
}
.basic-grey label>span {
float: left;
width: 80px;
text-align: right;
padding-right: 10px;
margin-top: 10px;
color: #888;
}
.basic-grey select {
background: #FFF url('down-arrow.png') no-repeat right;
background: #FFF url('down-arrow.png') no-repeat right);
appearance:none;
-webkit-appearance:none;
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
width: 72%;
height: 30px;
}
.basic-grey textarea{
height:100px;
}
.basic-grey p {
display: inline ;
}
;}

标记:

<form name="frm1" action="index4.php" method="POST" class="basic-grey">
<h3>2. I have taught the course, several times face to face, that I wish to transform into a blended format. </h3>
<input type="radio" name="q2" value="1" /> <p>This statement accurately reflects my experience.</p><br>
<input type="radio" name="q2" value="2" /> <p>This statement partially reflects my experience (I have taught the course only a few times or once before).</p><br>
<input type="radio" name="q2" value="3" /> <p>This statement does not reflect my experience (this a new course that I will teach for the first time in a blended format).</p><br>
<br>
<input type="submit" name="button" class="button" value="Submit" />
</form>

当我尝试 float 单选按钮时,所有文本都变得乱七八糟。

最佳答案

这很简单,只要把你的label元素到 display: block;并使用 margin-left对于 labelfloat你左边的单选按钮

Demo

Demo 2 (没什么特别的,只是用了多个 radio 来演示)

input[type=radio] {
float: left;
}

label {
margin-left: 30px;
display: block;
}

请注意,如果您将带有标签的 radio 存储在 li 中元素,类似

<ul class="radiolist">
<li>
<input type="radio"><label>Your text goes here</label>
</li>
</ul>

所以确保你使用类似的东西自行清除它们

.radiolist li:after {
content: "";
clear: both;
display: table;
}

这将确保您自行清除所有 li元素,以及关于 :after psuedo,它在 IE8 中得到了很好的支持,所以不用担心。

关于css - 防止单选按钮下方的文本换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23472949/

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