Forums

Give help. Get help.

  • # December 21, 2012 at 7:37 am

    I have a div 550 x 250 px. I want to insert an image (size width = 100px & height any size) in the middle of the div….

    # December 21, 2012 at 8:09 am

    @jurotek
    Thanks for reply. sorry mistake in my statement. your code only for fixed size of images. but i want to insert images of differ height…… please tell me solution for this issue.

    # December 21, 2012 at 8:10 am

    Why use absolute/relative positioning? Just use;

    img { display: block; margin: 0 auto; }

    Example pen: http://codepen.io/andyunleashed/pen/imdlA

    # December 21, 2012 at 8:23 am

    thanks @jurotek
    problem solved by using “display:table-cell” and “vertical-align:middle”. thanks for suggestion…..

    # December 21, 2012 at 9:24 am

    You can use CSS calc unit

    .logo {
    margin-top: calc(50% – logoheight);
    }

    # December 21, 2012 at 9:51 am

    @EkingRDL – Whoa now, that’s overkill for what’s needed and browser support is pretty dodgy – http://caniuse.com/#search=calc

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

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag