Grow your CSS skills. Land your dream job.

CSS Help: Img & Div

  • # January 26, 2013 at 7:19 am

    Hi,

    and here is css:

    .user_avatar {
    width: 75px;
    height: 75px;
    border: 1px solid #000000;
    overflow: hidden;
    margin: 2px 10px 0px 0px;
    }

    .user_avatar.img {
    width: 75px;
    height: auto;
    position: absolute
    }

    div is ok but “.user_avatar.img” not working, and img not resize to 75px, what’s the problem?
    i also change the css to:

    user_avatar.img

    and

    #user_avatar.img

    or

    #user_avatar.img.avatar

    but neither working!

    # January 26, 2013 at 8:00 am

    I think you should try


    .user_avatar img{
    width: 75px;
    height: auto;
    position: absolute;
    }

    the ‘.’ symbol is for class names. Anoher thing – are you trying to position the img absolutely in relation to the div? Then you’ll have to give a position:relative to the container div too.

    Here’s a pen

    http://codepen.io/Krish1980/pen/hBbEa

    # January 26, 2013 at 10:09 am

    yes, my problem was ‘.’ symbol.
    Thanks for your help, it works, here:

    http://codepen.io/Pedram/pen/rEibv

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".