I am trying to achieve a vertically aligned child elements which have different heights.
Following is what I want to implement. Currently I set a different negative top margin on both buttons. I feel this can be done in a more cleaner way with a single generic ruling. Please share your thoughts.
Following is the code to illustrate the problem:
.container {
padding: 35px 2px;
border: 1px solid gray;
}
.title {
font-size: 18px;
}
.action-button {
float: right;
height: 50px;
width: 100px;
}
.small-screen {
width: 160px;
display: inline-block;
}
HTML:
<div class="container">
<span class="title">
Card header
</span>
<button class="action-button">
Action
</button>
</div>
<br/>
<div class="container">
<span class="title small-screen">
Card header title here is longer
</span>
<button class="action-button">
Action
</button>
</div>
Link to JSFiddle