I’m trying to make a button that fills the whole width and has an icon on the right side. We’re using a shared library for buttons that doesn’t allow icons within the element, so I have to use some negative margin hacky solution to get it to work as intended.
The problem I’m running into is that I can’t get a width: 100% button to sit on the same line as an icon image.
.foo {
background: yellow;
}
.one {
background: pink;
width: 100%;
display: inline;
}
.two {
display: inline;
height: 20px;
margin-left: -20px;
background-color: green;
}
<div class="foo">
<button class="one">
This is a really cool button
</button>
<img class="two" src="https://cdn-icons-png.flaticon.com/512/5650/5650380.png">
</div>
Is there some way to keep the two aligned while giving the button 100% of the width?
2
Answers
something like that ?
It is possible that way with some coordination trys.
css:
html: