Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: placing images

  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question placing images

    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?

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    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!

  • #3
    Regular Coder BoldUlysses's Avatar
    Join Date
    Jan 2008
    Location
    Winston-Salem, NC
    Posts
    938
    Thanks
    10
    Thanked 190 Times in 187 Posts
    As JC points out, those attributes are deprecated. Use CSS margins or padding instead.
    matt | design | blog

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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:
    Code:
    <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.

    Code:
    #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:
    Code:
    #myImage {
    float: left;
    margin: 20px 0 0 50px;
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you very much about the suggestions, but probably because of being unclear, i couldnt get the solution that i am looking for 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

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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/artic...ning-pitfalls/

    Have a look at http://w3schools.com/ for both methods.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •