The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › CSS alignment without using tables
Im trying to align some text and a field using CSS only Like this….
Phone: [123456]
I tried everything (and the vertical-align:middle does nothing)
Any ideas would be helpful :)
http://codepen.io/DonTron/pen/zBrGBK
Just use the html form element instead. Something like
<form> First name: <input type=”text” name=”FirstName”><br> Last name: <input type=”text” name=”LastName”><br> <input type=”submit” value=”Submit”> </form>
vertical-align doesn’t work on floated elements…nor should float be used as the same time as display:inline…they’re mutually exclusive.
vertical-align
float
display:inline
If you remove the float and use display:inline-block then vertical-align works.
display:inline-block
http://codepen.io/Paulie-D/pen/NrxGwd
Re: the previous post, it’s considered bad practice to use br tags for spacing…that’s what margins and padding are for.
br
Thanks Paulie_D – that was an easy and effective fix!! I didnt know about inline-block :-)