Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS alignment without using tables

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #242686
    DonTron
    Participant

    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

    #242690
    I.m.learning
    Participant

    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>

    #242691
    Paulie_D
    Member

    vertical-align doesn’t work on floated elements…nor should float be used as the same time as display:inline…they’re mutually exclusive.

    If you remove the float and use display:inline-block then vertical-align works.

    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.

    #242702
    DonTron
    Participant

    Thanks Paulie_D – that was an easy and effective fix!!
    I didnt know about inline-block :-)

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.