...
Code Block | ||
---|---|---|
| ||
img { display: block; //* Make sure img tag acts like a block level element. */ max-width: 100%; //* Part 1: Set a maximum relative to the parent. */ height: auto; //* Part 2: Scale the height according to the width, otherwise you get stretching. */ } |
When using bootstrap this can be made even simpler by simply extending the 'img-responsive' class:
Code Block | ||
---|---|---|
| ||
img { @extend .img-responsive; } |
...