Charles Robertson
Charles Robertson

Reputation: 1

In CSS, what is the difference between image width:100% and max-width:100%?

I always used to write the following, mainly for mobile templates:

img{
    width:100%;
}

But, I see everywhere that, the following is used:

img{
    max-width:100%;
}

Surely, the two pieces of CSS, do exactly the same thing? Or am I going mad?

Upvotes: 0

Views: 82

Answers (1)

DesVeloper
DesVeloper

Reputation: 11

for example IMG with { width: 32px; } it mean 32px = 100% then 200% = 64px
so max-width will be <= 32 only.

Upvotes: 1

Related Questions