I'm quite new to CSS. I have this text box that is dynamically aligned using flex. Then a button underneath. The button is stuck to the left of the text box.
But I want it to align to the right edge of the text box. I've tried to use various alignments in .form-buttons to push the button right, but it seems stuck. I'm not sure if it's the way I've nested the html elements.
.search_btn {
width: 200px;
padding: 10px;
background-color: black;
color: white;
border: 0;
}
.search_btn:hover {
box-shadow: 1px 1px 1px grey;
}
input {
padding: 5px;
}
.search_section {
padding-top: 10px;
padding-bottom: 10px;
}
.search_options {
padding-bottom: 10px;
}
.row {
display: flex;
padding-top: 10px;
padding-bottom: 10px;
}
.left_label {
flex-basis: 20%;
}
.txt_box {
margin: 0;
flex-basis: 80%;
}
.form-buttons {
margin-left: left;
}
<form action="/action_page.php">
<div class="search_section">
<div class="search_options">
<h3 class="tit_label" for="fname">Alignment:</h3>
<div class="row">
<label class="left_label" for="fname">aligns left:</label>
<input class="txt_box" type="text" id="fname" name="fname" />
</div>
</div>
<div class="form-buttons">
<input class="search_btn" type="submit" value="aligns below to the right" />
</div>
</form>