Make an image grow proportionally up to a specific limit

1

Make an image grow proportionally to the limit of an area follow the example in the image below

    
asked by anonymous 11.09.2015 / 07:44

2 answers

1

max-width

div.imagem{
    width: 210px;
    height: 210px;
}

div.imagem img{
    width: 100%;
    max-width: 198px; // Sua Primeira Imagem
}
    
11.09.2015 / 13:14
1

Use only the max-width property, as shown below:

div.imagem img{
 max-width:100%;// primeira imagem
}

You have already defined the size of the area where the image will be inserted, so the image will occupy 100% of this area.

    
17.09.2015 / 15:37