标签不会显示在单选按钮旁边

时间:2019-08-07 08:30:46

标签: html css twitter-bootstrap

我在网站上添加了一个表单,该表单包含多个步骤。一切正常,但是由于某种原因,我在表单中使用的单选按钮不会在单选按钮旁边显示标签,但会在下方显示标签。

试图更改CSS文件,但似乎根本找不到为什么这样做。我想念一些东西...

body{
  color:#333;
  background:#FFF;
}

input[type="text"],
input[type="email"],
select.form-control {
    height: 50px;
    margin: 0;
    padding: 0 20px;
    vertical-align: middle;
    background: #f8f8f8;
    border: 3px solid #ddd;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 50px;
    color: #888;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
    -o-transition: all .3s;
    -moz-transition: all .3s;
    -webkit-transition: all .3s;
    -ms-transition: all .3s;
    transition: all .3s;
}

input[type=radio] {
	height:20px;
    margin-top: 8px !important;
}

textarea,
textarea.form-control {
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 30px;
}

input[type="text"]:focus,
textarea:focus,
textarea.form-control:focus {
    outline: 0;
    background: #fff;
    border: 3px solid #ccc;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

input[type="text"]:-moz-placeholder,
textarea:-moz-placeholder,
textarea.form-control:-moz-placeholder {
    color: #888;
}

input[type="text"]:-ms-input-placeholder,
textarea:-ms-input-placeholder,
textarea.form-control:-ms-input-placeholder {
    color: #888;
}

input[type="text"]::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
textarea.form-control::-webkit-input-placeholder {
    color: #888;
}

button.btn {
    height: 50px;
    margin: 15px 0 0 0;
    padding: 0 20px;
    vertical-align: middle;
    background: #2d3e50;
    ;
    border: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 50px;
    color: #fff;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    text-shadow: none;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
    -o-transition: all .3s;
    -moz-transition: all .3s;
    -webkit-transition: all .3s;
    -ms-transition: all .3s;
    transition: all .3s;
}

button.btn:hover {
    opacity: 0.6;
    color: #fff;
}

button.btn:active {
    outline: 0;
    opacity: 0.6;
    color: #fff;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

button.btn:focus {
    outline: 0;
    opacity: 0.6;
    background: #FF0000;
    ;
    color: #fff;
}

button.btn:active:focus,
button.btn.active:focus {
    outline: 0;
    opacity: 0.6;
    background: #FF0000;
    ;
    color: #fff;
}


strong {
    font-weight: 500;
}

.btn-link-1 {
    display: inline-block;
    height: 50px;
    margin: 0 5px;
    padding: 16px 20px 0 20px;
    background: #26A69A;
    font-size: 16px;
    font-weight: 300;
    line-height: 16px;
    color: #fff;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}

.btn-link-1:hover,
.btn-link-1:focus,
.btn-link-1:active {
    outline: 0;
    opacity: 0.6;
    color: #fff;
}

.btn-link-2 {
    display: inline-block;
    height: 50px;
    margin: 0 5px;
    padding: 15px 20px 0 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #fff;
    font-size: 16px;
    font-weight: 300;
    line-height: 16px;
    color: #fff;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}

.btn-link-2:hover,
.btn-link-2:focus,
.btn-link-2:active,
.btn-link-2:active:focus {
    outline: 0;
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

.form-box {
    margin-top: 40px;
    margin-bottom:40px;
    padding:0;
    font-family: 'Roboto', sans-serif !important;
	-webkit-box-shadow: 0px 0px 30px 8px rgba(0,0,0,0.15);
	-moz-box-shadow: 0px 0px 30px 8px rgba(0,0,0,0.15);
	box-shadow: 0px 0px 30px 8px rgba(0,0,0,0.15);
}

.form-top {
    overflow: hidden;
    padding: 0 25px 15px 25px;
    background: #2d3e50;
    -moz-border-radius: 4px 4px 0 0;
    -webkit-border-radius: 4px 4px 0 0;
    border-radius: 4px 4px 0 0;
    text-align: left;
    color: #fff;
    transition: opacity .3s ease-in-out;
}

.form-top h3 {
    color: #fff;
}

.form-bottom {
    padding: 25px 25px 30px 25px;
    background: #eee;
    -moz-border-radius: 0 0 4px 4px;
    -webkit-border-radius: 0 0 4px 4px;
    border-radius: 0 0 4px 4px;
    text-align: left;
    transition: all .4s ease-in-out;
}

.form-bottom:hover {
    -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

form .form-bottom button.btn {
    min-width: 105px;
}

form .form-bottom .input-error {
    border-color: #d03e3e;
    color: #d03e3e;
}

form.registration-form fieldset {
    display: none;
}
<!-- 
  Bootstrap docs: https://getbootstrap.com/docs
-->

<div class="container">
  <div class="row">
   <div class="col-md-12 form-box">
     <form action="" method="post" class="registration-form">
         <div class="form-top">
           <h3>1. Aantal werknemers binnen je organisatie</h3>
         </div>
         <div class="form-bottom">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="form-group">
                                            <input type="radio" class="form-control" name="q1" id="q1" value="0">
                                            <label>0 werknemers</label>                                          
                                            <input type="radio" class="form-control" name="q1" id="q1" value="1-5">
                                            <label>1 - 3 werknemers</label>
                                            <input type="radio" class="form-control" name="q1" id="q1" value="6-10">
                                            <label>4 - 10 werknemers</label>
                                            <input type="radio" class="form-control" name="q1" id="q1" value="11-19">
                                            <label>11 - 50 werknemers</label>
                                            <input type="radio" class="form-control" name="q1" id="q1" value="+50">
                                            <label>meer dan 50 werknemers</label>
                                        </div>
                                    </div>
                                </div>
                                <button type="button" class="btn btn-next">Volgende</button>
                            </div>
     </form>
   </div>
  </div>
</div>

请参阅:https://jsfiddle.net/diegie/odfv0h6s/1/

有人看到我要去哪里了吗?

2 个答案:

答案 0 :(得分:0)

看看这个: 添加了网格(您可以在css文件的末尾看到它)并更改了标签和输入的位置。希望能帮助到你。 :)最终看网格课程。     See: https://jsfiddle.net/b76s4tf0/3/

答案 1 :(得分:0)

请看一下小提琴文件,我在每个组之后添加了float和clear属性。

fiddle

HTML

<div class="container">
  <div class="row">
    <div class="col-md-12 form-box">
      <form action="" method="post" class="registration-form">
        <div class="form-top">
          <h3>1. Aantal werknemers binnen je organisatie</h3>
        </div>
        <div class="form-bottom">
          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <input type="radio" class="form-control" name="q1" id="q1" value="0" />
                <label>0 werknemers</label>
                <p class="clear"></p>
                <input type="radio" class="form-control" name="q1" id="q1" value="1-5" />
                <label>1 - 3 werknemers</label>
                <p class="clear"></p>
                <input type="radio" class="form-control" name="q1" id="q1" value="6-10" />
                <label>4 - 10 werknemers</label>
                <p class="clear"></p>
                <input type="radio" class="form-control" name="q1" id="q1" value="11-19" />
                <label>11 - 50 werknemers</label>
                <p class="clear"></p>
                <input type="radio" class="form-control" name="q1" id="q1" value="+50" />
                <label>meer dan 50 werknemers</label>
                <p class="clear"></p>
              </div>
            </div>
          </div>
          <button type="button" class="btn btn-next">Volgende</button>
        </div>
      </form>
    </div>
  </div>
</div>

css

body {
  color: #333;
  background: #fff;
}

input[type="text"],
input[type="email"],
select.form-control {
  height: 50px;
  margin: 0;
  padding: 0 20px;
  vertical-align: middle;
  background: #f8f8f8;
  border: 3px solid #ddd;
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 50px;
  color: #888;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  -o-transition: all 0.3s;
  -moz-transition: all 0.3s;
  -webkit-transition: all 0.3s;
  -ms-transition: all 0.3s;
  transition: all 0.3s;
}

input[type="radio"] {
  height: 20px;
  margin-top: 0px;
  float: left;
}

textarea,
textarea.form-control {
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 30px;
}

input[type="text"]:focus,
textarea:focus,
textarea.form-control:focus {
  outline: 0;
  background: #fff;
  border: 3px solid #ccc;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  box-shadow: none;
}

input[type="text"]:-moz-placeholder,
textarea:-moz-placeholder,
textarea.form-control:-moz-placeholder {
  color: #888;
}

input[type="text"]:-ms-input-placeholder,
textarea:-ms-input-placeholder,
textarea.form-control:-ms-input-placeholder {
  color: #888;
}

input[type="text"]::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
textarea.form-control::-webkit-input-placeholder {
  color: #888;
}

button.btn {
  height: 50px;
  margin: 15px 0 0 0;
  padding: 0 20px;
  vertical-align: middle;
  background: #2d3e50;
  border: 0;
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 50px;
  color: #fff;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
  text-shadow: none;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  -o-transition: all 0.3s;
  -moz-transition: all 0.3s;
  -webkit-transition: all 0.3s;
  -ms-transition: all 0.3s;
  transition: all 0.3s;
}

button.btn:hover {
  opacity: 0.6;
  color: #fff;
}

button.btn:active {
  outline: 0;
  opacity: 0.6;
  color: #fff;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  box-shadow: none;
}

button.btn:focus {
  outline: 0;
  opacity: 0.6;
  background: #ff0000;
  color: #fff;
}

button.btn:active:focus,
button.btn.active:focus {
  outline: 0;
  opacity: 0.6;
  background: #ff0000;
  color: #fff;
}

strong {
  font-weight: 500;
}

.btn-link-1 {
  display: inline-block;
  height: 50px;
  margin: 0 5px;
  padding: 16px 20px 0 20px;
  background: #26a69a;
  font-size: 16px;
  font-weight: 300;
  line-height: 16px;
  color: #fff;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
}

.btn-link-1:hover,
.btn-link-1:focus,
.btn-link-1:active {
  outline: 0;
  opacity: 0.6;
  color: #fff;
}

.btn-link-2 {
  display: inline-block;
  height: 50px;
  margin: 0 5px;
  padding: 15px 20px 0 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #fff;
  font-size: 16px;
  font-weight: 300;
  line-height: 16px;
  color: #fff;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
}

.btn-link-2:hover,
.btn-link-2:focus,
.btn-link-2:active,
.btn-link-2:active:focus {
  outline: 0;
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
}

.form-box {
  margin-top: 40px;
  margin-bottom: 40px;
  padding: 0;
  font-family: "Roboto", sans-serif !important;
  -webkit-box-shadow: 0px 0px 30px 8px rgba(0, 0, 0, 0.15);
  -moz-box-shadow: 0px 0px 30px 8px rgba(0, 0, 0, 0.15);
  box-shadow: 0px 0px 30px 8px rgba(0, 0, 0, 0.15);
}

.form-top {
  overflow: hidden;
  padding: 0 25px 15px 25px;
  background: #2d3e50;
  -moz-border-radius: 4px 4px 0 0;
  -webkit-border-radius: 4px 4px 0 0;
  border-radius: 4px 4px 0 0;
  text-align: left;
  color: #fff;
  transition: opacity 0.3s ease-in-out;
}

.form-top h3 {
  color: #fff;
}

.form-bottom {
  padding: 25px 25px 30px 25px;
  background: #eee;
  -moz-border-radius: 0 0 4px 4px;
  -webkit-border-radius: 0 0 4px 4px;
  border-radius: 0 0 4px 4px;
  text-align: left;
  transition: all 0.4s ease-in-out;
}

.form-bottom:hover {
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16),
    0 2px 10px 0 rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16),
    0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

form .form-bottom button.btn {
  min-width: 105px;
}

form .form-bottom .input-error {
  border-color: #d03e3e;
  color: #d03e3e;
}

form.registration-form fieldset {
  display: none;
}

p.clear {
  height: 0;
  margin: 0;
  padding: 0;
  clear: both;
}

label {
  float: left;
  line-height: 20px;
}

input[type="radio"] {
  height: 20px;
  margin-top: 0px;
  float: left;
}
相关问题