View Full Version : CSS 4 Image: hspace,vspace,align

12-27-2002, 11:36 AM
I searched for an answer at Google and at the w3schools.com and found nothing about it.
I want to know what CSS properties replaces the hspace, vspace and the align methods for the IMG tag.
I tried: style="vertical-align:left"
but it didn't work.
Someone can help me with that?

12-27-2002, 12:05 PM
how about relative positioning?

12-27-2002, 12:07 PM
The left/right alignment can be set with the text-align property on an inline element: style="text-align: left;" This will cause the text to wrap around the element. It can take values of left, right or none (none is the default). The vertical align determines where the image appear relative to the line of text it's embedded within: style="vertical-align: middle". It can take values of top, middle bottom (and a few others). hspace can be acheive by setting the left and right margins on the element.

12-27-2002, 12:14 PM
Margin. Margin-top, margin-right, margin-bottom, margin-left.
<img style="margin: 10px;" (all margins 10px)
<img style="margin: 10px 5px;" (top and bottom 10px, left and right 5px)
<img style="margin: 10px 5px 8px 4px;" (top, right, bottom, left)

12-27-2002, 02:07 PM
I tried margin and padding and now I tried text-align too, but it doesn't seem to work.
Look at:
The lower picture is what I have with HTML properties (hspace,vspace,align) and the higher one is styled with CSS.
Look at the source and try to find out what is wrong.
Thanks for your help.

12-27-2002, 02:25 PM
You need to tell the element to float:
style="float: right; margin: 3px;"

12-27-2002, 02:32 PM
Originally posted by Kiwi
You need to tell the element to float:
style="float: right; margin: 3px;"
Great! Thanks.
Can you refer me to a place I can read about float?

12-27-2002, 04:48 PM
float example using images:

12-27-2002, 06:22 PM
w3c recommendations - floats (http://www.w3.org/TR/REC-CSS2/visuren.html#floats)

12-27-2002, 07:27 PM
Thanks to you all!