#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    Help, Center a IMG in a div (dynamic image)


    Hi,

    I have a problem to center a dynamic img into a div.
    When i write "position: absolut;" for the image, the image center but isn't more dynamic.

    When i delete the "position: absolut;" line, the image is dynamic but i can't center it, even with "margin: 0px auto 0px auto;"

    i just try to learn css, but this makes my crazy,im siting for hours with trying and reading.

    BODY {
    background-color: #FFF;
    color: #333;
    margin: 0px;
    }


    #MAINBOX {
    width: 700px;
    height: 400px;
    margin: 200px auto 0px auto;
    padding: 5px;
    text-align: center;

    border: 1px solid #000;
    }


    #LOGO {
    position: absolut;
    width: 60%;
    margin: 0px auto 0px auto;
    }
  2. #2
  3. ~ bald headed old fart ~
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2005
    Location
    chertsey, a small town s.w. of london, england
    Posts
    253
    Rep Power
    87
    Hi there keen098,

    and a warm welcome to these forums.

    Try it like this...
    Code:
    
    #logo {
        display:block;
        width:60%;
        margin:auto;
     }
    
    coothead

IMN logo majestic logo threadwatch logo seochat tools logo