Skip to content
Advertisement

How to get radio button to stay aligned when label text wraps to next line?

Right now I have radio button aligned at the prefix text, but when label text becomes long and wrap to next line, for some reason the radio button to move downward and no longer aligned to prefix text. But I would like radio button to stay still whether label gets wrapped or not. What changes do I need to make in css? https://codepen.io/Judoboy/pen/dydLPJE

JavaScript
JavaScript

Advertisement

Answer

You can simplify your CSS, remove the position:relative; top: -8px, change align-items to flex-start

JavaScript
JavaScript

if what you really want is having the input to be centered to prefix text despite the font-size, then you can do this:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement