EyalBH
EyalBH

Reputation: 48

HTML: img tag near a input

I have a weird problem, when i'm adding a img tag near a input and a span the img causing the input and the sapn to lower down.

<div>
   <span>נקודות זיכוי</span>
   <input type="text" name="nekodot_zikoy" value="2.25"/>
   <img src="images/cal_black.png" title="חשב נקודות זיכוי" alt="חשב נקודות זיכוי"/>
</div>

I have the code here http://jsfiddle.net/49JcA/

just don't mind that there is no images if you take the tag out and see what i talking about..

Thank's!

Upvotes: 0

Views: 308

Answers (2)

Grant Thomas
Grant Thomas

Reputation: 45083

You can use vertical-align, for instance:

* { vertical-align:top; } 

But note, you do not want to do it like this. Others may argue that you shouldn't even use vertical-align like this, but I won't complain about that if it works for you, but specifying this globally (using *) is wrong and bad for performance. Instead you should apply it to the elements you need, which vary in this case. So, something like this:

input[type=text] { vertical-align:top; }

And any other elements you need this applied to.

Lastly, you should be labeling input for compliance.

Upvotes: 1

Shadow Wizard
Shadow Wizard

Reputation: 66388

Assuming you want the span and input to appear on top, just add align="top" to the image:

<img src="images/cal_black.png" align="top" ... />

Updated fiddle.

Upvotes: 1

Related Questions