View Single Post
Old 07-25-2017, 11:16 AM   #3
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,361
Karma: 20212223
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I'm not sure it is even necessary to do those calculations?? For non-full-page images all you need to do is set the width in % and the height is automatically figured keeping the proper aspect-ratio. This will keep the image at your given % of the screen. To prevent over stretching the image for large screens you just add the max-width property.

For example:
Code:
div.image2  {width:60%; max-width:626px; text-align:center;
             margin:1em auto; text-indent:0; padding:0}


<div class="image2"><img alt="" src="../Images/Image-02.jpg" /></div>
edit: I just noticed you used the id property. You can perform the same function using the id instead of a class name like this:

Code:
#fig-2  {width:60%; max-width:626px; text-align:center;
         margin:1em auto; text-indent:0; padding:0}


<div id="fig-2"><img alt="" src="../Images/Image-02.jpg" /></div>

Last edited by Turtle91; 07-25-2017 at 11:40 AM.
Turtle91 is offline   Reply With Quote