Documentation
Floating Images
Floating image widths shouldn't exceed more than 35%
. If a floating left or right image is to be used the export from InDesign should be checked since the image can sometimes be placed right before a header and could cause rendering issues, example:
Bad
html1<p>Bacon ipsum dolor amet bresaola bacon picanha, ground round fatback doner jowl.</p>2<div class="imgLeft">3<img src="../img/foo.png" alt="foo" />4</div>5<h2>Frankfurter</h2>6<p>7Frankfurter corned beef tenderloin andouille, meatloaf chuck tongue biltong sausage picanha pork8chop ham hock.9</p>10<p>11Chicken drumstick ham corned beef, pork chop meatloaf ground round doner kevin. Jerky chuck shank12sausage.13</p>
Moved image before the <p>
:
Good
html1<div class="imgLeft">2<img src="../img/foo.png" alt="foo" />3</div>4<p>Bacon ipsum dolor amet bresaola bacon picanha, ground round fatback doner jowl.</p>5<h2>Frankfurter</h2>6<p>7Frankfurter corned beef tenderloin andouille, meatloaf chuck tongue biltong sausage picanha pork8chop ham hock.9</p>10<p>11Chicken drumstick ham corned beef, pork chop meatloaf ground round doner kevin. Jerky chuck shank12sausage.13</p>
Left Float
HTML
html1<div class="imgLeft">2<img src="../img/foo.png" alt="foo" />3</div>
CSS
css1.imgLeft {2text-align: justify;3width: 35%;4float: left;5margin: 0 0.3em 1em 0;6}7.imgLeft img {8display: inline-block;9width: 100%;10page-break-inside: avoid !important;11}
Right Float
HTML
html1<div class="imgRight">2<img src="../img/bar.png" alt="bar" />3</div>
CSS
css1.imgRight {2text-align: justify;3width: 35%;4float: right;5margin: 0 0 1em 0.3em;6}7.imgRight img {8display: inline-block;9width: 100%;10page-break-inside: avoid !important;11}
Both
Note
Image margin should always be checked/modified and the current code examples are just for rendering. Every title's CSS has different font size, line height and margin which are factors in good rendered floating images.
If both floating right and left images are being used the CSS can be consolidated to:
css1.imgLeft,2.imgRight {3text-align: justify;4width: 35%;5}6.imgLeft {7float: left;8margin: 0 0.3em 1em 0;9}10.imgRight {11float: right;12margin: 0 0 1em 0.3em;13}14.imgLeft img,15.imgRight img {16display: inline-block;17width: 100%;18page-break-inside: avoid !important;19}