add image to header with css code example

Example 1: add image under header html

<div class="container">
  <header>
    <h2>Header Text</h2>
  </header>
  <div class="banner"></div>
  <div class="content">
    <h3>Content</h3>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
      in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
    </p>
  </div>
  <div class="banner"></div>
</div>

Example 2: add image under header html

.container {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.banner {
  height: 100px;
  background: url(https://dreaminginyellow.com/diy-custom-design-yellow-strips/) bottom center no-repeat
}

Tags:

Html Example