<div class="container">
  <h1>The following content uses block and inline layout</h1>
  <p>Block elements extend to fill the container in the inline direction. They break onto a new line. Any inline elements such as a <span>span</span> do not break onto a new line.</p>
  <div class="media">
    <div class="img"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/balloon-sq1.jpg" alt="balloons"></div>
    <div class="content">
      <h2>Media Object</h2>
      <p>Content inside the flex item returns to block flow layout.</p>
  <p>Unless you change the value of display, elements continue to display using these block and inline rules.</p>
body {
  padding: 20px;
  font: 1em Helvetica Neue, Helvetica, Arial, sans-serif;

.media {
  display: flex;
  border: 1px solid #ccc;
  padding: 1em;

.media .img {
  width: 100px;
  margin: 0 1em 0 0;

span {
  color: rebeccapurple;
  font-weight: bold;

.container {
  margin: 0 auto;
  max-width: 700px;

img {
  max-width: 100%;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.