Harvard Extension School, Fall 2018
CSCI E-12 Fundamentals of Web Site Development

## How to get image to be contained in box?

- stick with "p"
- use "br" and block display

Example 4.13 - clear: right; - Example 4.13 (Without Styles) | <p class="airplane"><img src="http://cscie12.dce.harvard.edu/resources/images/777-t2-1.png" alt="777"/>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed feugiat nisi at sapien. Phasellus varius tincidunt ligula. Praesent nisi. Duis sollicitudin. Donec dignissim, est vel auctor blandit, ante est laoreet neque, non pellentesque mauris turpis eu purus.<br class="clearme"/></p><p class="airplane"><img src="http://cscie12.dce.harvard.edu/resources/images/777-t2-2.png" alt="777"/>Suspendisse mollis leo nec diam. Vestibulum pulvinar tellus sit amet nulla fringilla semper. Aenean aliquam, urna et accumsan sollicitudin, tellus pede lobortis velit, nec placerat dolor pede nec nibh. Donec fringilla. Duis adipiscing diam at enim. Vestibulum nibh.<br class="clearme"/></p><p class="airplane"><img src="http://cscie12.dce.harvard.edu/resources/images/777-t2-3.png" alt="777"/>Proin sollicitudin ante vel eros. Nunc tempus. Quisque vitae quam non magna mattis volutpat. Nulla vulputate, erat nec tempor mollis, augue metus feugiat urna, id nonummy velit arcu in metus. Donec nonummy, pede non convallis commodo, enim velit ornare nulla, vitae suscipit risus urna eget magna. Maecenas aliquam arcu ac turpis. <br class="clearme"/></p>p.airplane { clear: right; line-height: 1.5em; padding: 1em; margin: 1em; border: medium solid blue; } .airplane img { float: right; border: thin dotted black; padding: 5px; } br.clearme { clear: both; padding: 0; margin: 0; visibility: hidden; display: block }

- Markup
- Style
- Screenshot

    <p class="airplane"><img src="images/777-t2-1.png" alt="777"/>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed feugiat nisi at sapien. Phasellus varius tincidunt ligula. Praesent nisi. Duis sollicitudin. Donec dignissim, est vel auctor blandit, ante est laoreet neque, non pellentesque mauris turpis eu purus.<br class="clearme"/></p>
    <p class="airplane"><img src="images/777-t2-2.png" alt="777"/>Suspendisse mollis leo nec diam. Vestibulum pulvinar tellus sit amet nulla fringilla semper. Aenean aliquam, urna et accumsan sollicitudin, tellus pede lobortis velit, nec placerat dolor pede nec nibh. Donec fringilla. Duis adipiscing diam at enim. Vestibulum nibh.<br class="clearme"/></p>
    <p class="airplane"><img src="images/777-t2-3.png" alt="777"/>Proin sollicitudin ante vel eros. Nunc tempus. Quisque vitae quam non magna mattis volutpat. Nulla vulputate, erat nec tempor mollis, augue metus feugiat urna, id nonummy velit arcu in metus. Donec nonummy, pede non convallis commodo, enim velit ornare nulla, vitae suscipit risus urna eget magna. Maecenas aliquam arcu ac turpis.<br class="clearme"/></p>

In `style` element (`<style type="text/css">`) within `head` element:

    p.airplane {
      clear: right;
      line-height: 1.5em;
      padding: 1em;
      margin: 1em;
      border: medium solid blue;
    }
    .airplane img {
      float: right;
      border: thin dotted black;
      padding: 5px;
    }
    br.clearme {
      clear: both;
      padding: 0;
      margin: 0;
      visibility: hidden;
      display: block
    }

Copyright © David Heitmeyer