Hero Images: Image Tag

In this example below you will see how to do a Hero Images: Image Tag with some HTML / CSS and Javascript

Read the article here: http://praliedutzel.com/a-guide-to-hero-images/

This awesome code was written by praliedutzel, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright praliedutzel ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>Hero Images: Image Tag</title>
      <link rel="stylesheet" href="css/style.css">



  <header class="header">
  <h1 class="header__title">A Guide to Hero Images: Image Tag</h1>
  <a href="http://praliedutzel.com/a-guide-to-hero-images/" target="_blank">Read the Article</a>

<section class="hero">
  <img src="http://placehold.it/500x300" alt="Hero Images with Image Tags" class="hero__media">
  <div class="hero__content">
    <h2>Hero Images</h2>
    <p>Can be created with an image tag when they support the content.</p>



/*Downloaded from https://www.codeseek.co/praliedutzel/hero-images-image-tag-GogNYE */
.hero {
  background-color: #fff;
  position: relative;

.hero__media {
  width: 100%;

.hero__content {
  top: 50%;
  padding: 3rem;
  position: absolute;
  transform: translateY(-50%);
  text-align: left;

body {
  background-color: #f9f9f9;
  margin: 0;
  padding: 0;
  font-family: "Open Sans", Helvetica Neue, Helvetica, Arial, sans-serif;
  text-align: center;

.header {
  background-color: #232439;
  padding: 4rem 2rem;
  text-align: center;
.header a {
  margin-top: 1rem;
  display: block;
  color: #6ddce5;
  font-size: 0.85rem;
  text-decoration: none;

.header__title {
  margin: 0;
  color: #fff;
  font-weight: 300;