lundi 20 avril 2015

Adjusting Image Size with CSS For Mobile Website

  • I am having trouble adjusting images in blog articles in mobile theme. Somehow they are messing up the layout. I use the following code for images in articles.

    1) <div class="leftbox"><img src="http://.mysite.net/blog/media/Photo/Indian_tourists.jpg" width="400" height="267" alt="Indian tourists" title="Indian tourists" /></div>

    2) <div style="text-align: center"><img src="http://ift.tt/1J2yaLv" width="520" height="347" alt="Surfing in France" title="Surfing in France" /></div>

    I have added these codes to ensure that images don't alter the width but it seems they are not working.

    .post_content img { height: auto !important; max-width: 100% !important; }

    .leftbox img { height: auto !important; max-width: 100% !important; }

This is example of a link where image would stretch on mobile devices - http://ift.tt/1JmlNqx

Aucun commentaire:

Enregistrer un commentaire