Search code examples
htmlcssmedia-queries

Align image in center if wither then container


I added picture that is wider than viewport I lookat ,, somewhere 1000px wide ,, and I'd like it to be aligned in the middle somehow ..

The smaller picture of eye lower would need to be as is ..

I played with transform: translate(-50%,-50%); and align attributes and margin: -50% but I guess I'd need to use media queries for that ..

This is my blog:

http://blog.mk-dizajn.com/

thanks for any help ..


Solution

  • Just add this rules to your images and it will scale to your viewport

    CSS

    img {
        max-width:100%;
        height:auto;
    }
    

    But you should be sure that you dont have width and height attributes on your image tag