Media object

Image + text. Or reverse.

Media object

Image + text

In this variation of the media object the image is placed to the left and the text to the right. In both variants both the image and the text goes full on small screens.

Media object

Text + image

In this variation of the media object the text is placed to the left and the image to the right. In both variants both the image and the text goes full on small screens.

HTML

<div class="media">
	<img src="/assets/img/examples/media.jpg" alt="Media object" class="media__image">
	<div class="media__body">
		<h3>Image + text</h3>
		<p>In this variation of the media object the image is placed to the left and the text to the right. In both variants both the image and the text goes full on small screens.</p>
	</div>
</div>

<div class="media media--rev">
	<img src="/assets/img/examples/media.jpg" alt="Media object" class="media__image">
	<div class="media__body">
		<h3>Text + image</h3>
		<p>In this variation of the media object the text is placed to the left and the image to the right. In both variants both the image and the text goes full on small screens.</p>
	</div>
</div>

SCSS

// Media block
.media {
	@extend %module;
	@include cf;

	// Media elements
	&__image {
		float: left;
		margin-right: $grid-gutter / 2;
		padding-right: $grid-gutter / 2;
		width: 50%;
		max-width: none;

		img {
			display: block;
		}
	}

	&__body {
		overflow: hidden;

		& *:last-child {
			margin-bottom: 0;
		}
	}

	// Media modifier
	&--rev {

		.media__image {
			float: right;
	 		margin-right: 0;
	 		padding-right: 0;
			margin-left: $grid-gutter / 2;
			padding-left: $grid-gutter / 2;
		}
	}

	@include break(medium) {

		&__image,
		&__image img,
		&--rev &__image,
		&--rev &__image img {
			width: 100%;
			display: block;
			float: none;
			padding: 0;
			margin: 0 0 $grid-gutter / 2 0;
		}
	}
}