12345678910111213141516171819202122232425262728293031323334353637 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Media Object, utilizing the formatting context</title>
- <style type="text/css" media="screen">
- .media-block {
- background-color: gray;
- border: solid 1px black;
- }
- .media-fig {
- float: left;
- margin-right: 5%;
- }
- /**
- * 1. The overflow rule here creates a new formatting context,
- * causing both the container and the .media-body section
- * to contain their floats, and causes the .media-body element
- * to shift its starting edge so that it sits to the right of the
- * floated figure.
- */
- .media-body, .media-block {
- overflow: auto; /* 1 */
- }
- </style>
- </head>
- <body>
- <div class="media-block">
- <img class="media-fig" src="img/pic.png" alt="The pic" />
- <div class="media-body">
- <h3>Title of this</h3>
- <p>Brief description of this</p>
- </div>
- </div>
- </body>
- </html>
|