自分のボタンを自分の入力の下に揃えたいと思います。私は両方の要素にwidth: auto;
を持っています。私はそれをモバイルフレンドリーにするためにメディアクエリを使用していますが、私はそれを動作させることはありません。入力とボタンはお互いの下に揃っていません。 Hereは実際の例のためのフィドルです。改行の項目を整列する
Htmlの
<div class="card-zipcode">
<label>Postcode</label>
<div class="card-group">
<input type="text" class="input-zipcode">
<button class="btn-postnl" id="bekijken" type="submit">Bekijken</button>
</div>
</div>
のCss
.card-group {
display: flex;
justify-content: space-between;
}
.card-group input {
width: auto;
}
.btn-postnl {
display: inline-block;
position: relative;
height: 40px;
width: auto;
margin: 0;
padding: 0 20px;
vertical-align: top;
border: 1px solid rgba(0, 0, 0, 0);
background-color: #ED8C00;
-webkit-appearance: none;
outline: 0;
line-height: 38px;
font-size: 1em;
font-weight: 300;
color: #FFF;
cursor: pointer;
-webkit-transition: all .1s ease-out 0s;
transition: all .1s ease-out 0s;
border-radius: 3px;
}
@media only screen and (max-width: 400px) {
body {
background-color: #fff;
}
.card {
box-shadow: none;
margin-top: -1px;
}
.card-group {
}
}
ボタンの幅をコンテナの全幅にしたい場合は、 '.card-group'に' flex-direction:column; 'を追加することができます。 –