How to center an image vertically & horizontally inside a bigger div?

I need to center an image both vertically & horizontally inside a bigger div. How can I achieve this using CSS?

Comments

  • #yourImageContainer
    {
        background:url(some_image.jpg) no-repeat center center;
        height:300px;
        width:100px;
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion