KristianB
KristianB

Reputation: 1443

CSS - Images wont appear on same line as Select box

Check out my problem with this fiddle:

http://jsfiddle.net/85BN8/3/

Both the select and the img tag are set to have the same heights.

And yet this is not making them appear "on same line".

It is as if the select box prefer being aligned 'bottomly' vertically...

Does anyone have a tip?

Thanks in advance!

Edit: Thanks all. I accepted the answer that was first and worked. All others got +1 for their answer... Awesome!

Upvotes: 1

Views: 1867

Answers (4)

adarshr
adarshr

Reputation: 62623

Fixed it. Just add float: left to both of them.

http://jsfiddle.net/85BN8/12/

Upvotes: 3

thirtydot
thirtydot

Reputation: 228302

To #testdiv select, add vertical-align: top.

Live Demo

Upvotes: 2

Stephen Walcher
Stephen Walcher

Reputation: 2575

Add a float to your image. See below:

    #testdiv img {
        border:1px solid black;
        width:25px;
        height:25px;
        float: left;
    }

Upvotes: 1

meder omuraliev
meder omuraliev

Reputation: 186762

#testdiv img {
    border:1px solid black;
    width:25px;
    vertical-align:top;
    height:25px;
}

Try specifying vertical-align.

Upvotes: 2

Related Questions