Cover

Expand images or videos to cover their entire container.

This component allows you to create fullscreen teasers using images, objects or even iframes. Regardless what kind of element, it will always be centered vertically and horizontally and cover its container without losing its proportions. You can also place additional content, like text or an image, on top of the image or video.


Usage

The Cover component is applied differently, depending on whether you are using a background image, an object or an iframe. The simplest way is to add the .f-cover-background class to a <div> element with a background image.

Example

Markup

<div class="f-cover-background">...</div>

Video

To create a video that covers its parent container, add the .f-cover-object class to a video. Wrap a container element around the video and add the .f-cover class to clip the content.

Example

Markup

<div class="f-cover">
	<video class="f-cover-object" width="" height="">
		<source src="" type="">
	</video>
</div>

Iframe

To apply the Cover component to an iframe, you first need to include the cover.js file in your document. Afterwards, add the data-f-cover attribute to the iframe. Now you only need to add the .f-cover class to a container element around the iframe to clip the content.

Example

Markup

<div class="f-cover">
	<iframe data-f-cover src="" width="" height="" frameborder="0" allowfullscreen></iframe>
</div>

Responsive

To add responsive behavior to your cover image, you need to add the .f-invisible class to an <img> element and place it inside your cover element. That way it will adapt the responsive behavior of the image.

NOTE Adding the .f-height-viewport class from the Utility component will stretch the height of the parent element to fill the whole viewport.

Example

Placeholder

Markup

<div class="f-cover-background">
	<img class="f-invisible" src="" width="" height="" alt="">
</div>

Video

To add the same behavior to a video, you also need to add the .f-position-relative class to the cover container and the .f-position-absolute class to the cover object. The same applies to iframes.

Example

Markup

<div class="f-cover f-position-relative">
	<img class="f-invisible" src="" width="" height="" alt="">
	<video class="f-cover-object f-position-absolute" width="" height="">
		<source src="" type="">
	</video>
</div>

Position content

You can also position content absolutely on top of the covering element. To do so, just add the .f-position-cover class from the Utility component to a container element after your image or video. If you want to center the content vertically and horizontally, just use the Flex component.

Example

Bazinga!

Markup

<div class="f-cover-background f-position-relative">
	<img class="f-invisible" src="" width="" height="" alt="">
	<div class="f-position-cover f-flex-center f-flex-middle">...</div>
</div>