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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Centering an image in HTML?

    I'm trying to create a button image in HTML. and I would like the the button to be 100 pixels left of the center and 150 pixels from the top. I need it to work with different resolutions.

    This is what I tried which doesn't work.

    <img src="Banner/edv_banner.png" style="position: absolute; topcenter; no-repeat; top: 113px; left: 50px;">

    is this possible in HTML alone?

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    From the top of...what, exactly?

  • #3
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Try adding align="center" and then using additional css for the left:150px; using relative positioning.

  • #4
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I am almost 100% sure it cannot be done in HTML. There is a CSS thing.

    Try this

    PHP Code:
    padding-left100px;
    padding-top150px
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,680
    Thanks
    6
    Thanked 1,009 Times in 982 Posts
    Quote Originally Posted by omfgandy View Post
    is this possible in HTML alone?
    It is possible, but not if you write wrong code. What is this:

    Code:
    <img src="Banner/edv_banner.png" style="position: absolute; topcenter; no-repeat; top: 113px; left: 50px;">


    Please show us your entire code and maybe an image of how it should look like. I’m not psychic but I bet the banana I’m just eating that you’re kinda on the wrong path.

  • #6
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BarrMan View Post
    Try adding align="center" and then using additional css for the left:150px; using relative positioning.
    EDIT. nvm somthing messed up.


    Code:
    <html>
    <head><title>East Digital Vikings</title></head>
    <body background="Background/edv_tiledbackground.png"> 
    
    <center> 
    <img src="Banner/edv_banner.png">
    <img src="Background/edv_background.png">
    <img src="Buttons/home.bmp" style="position:relative;  top: 113px; left: -50px;">
    </center> 
    
    
    </body>
    </html>
    somebody requested the code. because I might be on the wrong path.
    I have never done HTML before.
    Last edited by omfgandy; 06-02-2009 at 08:44 PM.

  • #7
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,705
    Thanks
    0
    Thanked 235 Times in 230 Posts
    This solution...

    ...seemed to satisfy our friend omfgandy.

    coothead


  •  

    Tags for this Thread

    Posting Permissions

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