When a button is clicked, I want to display an input with a background surrounding both the button and the input. Currently, my markup renders like this:
https://i.sstatic.net/rxaPt.png
So when the button is clicked, I need a yellow (alert-warning) background around both the Reason button and the input. My markup currently looks like this:
div.saveReason {
display: inline;
background-color: #fff3cd;
border: solid 1px #ffeeba;
border-bottom-width: 0;
padding-bottom: 20px;
z-index: 1;
}
div.saveReasonDetail {
z-index: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div>
<a class="btn btn-primary mr-2 SaveEdits">Save</a>
<div class="saveReason"><a href="#" class="btn btn-secondary mr-2 SaveReason">Reason</a></div>
<a class="btn btn-link CancelEdits">Cancel</a>
<div class="alert alert-warning mt-2 saveReasonDetail">
<div class="form-group viReason">
<div class="validator-container">
<textarea name="iReason" rows="4" id="iReason" class="form-control iReason"></textarea>
</div>
</div>
</div>
</div>
The issues I'm encountering are:
1) I don't want the border underneath the button; I want the border only on the outside of the yellow background.
2) I want the yellow background to extend slightly beyond the reason button without affecting margins between other buttons.
Is it possible to achieve this?
Update: Kareem Dabbeet and Chase Ingebritson provided answers. Initially marked Kareem's answer as correct, but considering I'm not an HTML expert, Chase's comment about using a 'same container' seems important too. Do review his response as well.