View Full Version : placing images

02-16-2009, 04:19 PM
my question is that
while placing images to the page, using the vspace and hspace properties, is my base point the left top corner of the image or the center of the image?

02-16-2009, 04:28 PM
not exactly sure what you are asking, but dont use h-space or v-space anymore.

My suggestion is to use padding on your images. That way whatever text or object is around the image will not butt up to it.

Hope that helps!

02-16-2009, 04:35 PM
As JC points out, those attributes are deprecated (http://www.w3schools.com/tags/tag_img.asp). Use CSS margins or padding instead.

02-16-2009, 08:43 PM
Hello stephanruhl,
If you use floats and margins to position your images you can just picture the margin pushing on whichever edge of the image you tell it to.

Say this is your image:
<img src="../path/image.jpg" width="150" height="150" alt="description" id="myImage" />
Notice I gave the widths there. That does two things, it tells the browser what size the image is going to be before it loads and it needs to have a width so it can float.

#myImage {
float: left;
margin: x x x x;
That margin goes top,right,bottom,left; It's clockwise.

So if you want your image 20px down from the top and 50px overfrom the left you'd write it like this:

#myImage {
float: left;
margin: 20px 0 0 50px;

02-21-2009, 05:39 PM
thank you very much about the suggestions, but probably because of being unclear, i couldnt get the solution that i am looking for :D my first question is not so clear really, sorry for that...
so for an empty page how can i give the absolute coordinates to my image? i mean lets say that my image name is "mypic" and i wanna put it on the coordinates x=150px and y=100px?
my question may sound easy,but it is my very first web site project :D

02-21-2009, 06:45 PM
Floats and margins are usually the better way to position things. Absolute Positioning works but often creates more trouble than it solves - http://www.tyssendesign.com.au/articles/css/absolute-positioning-pitfalls/

Have a look at http://w3schools.com/ for both methods.