How to put an image behind text in CSS?

Cian OT picture Cian OT · May 25, 2016 · Viewed 15.4k times · Source

I want an image to be displayed behind some text in an <h1> tag. But when I add the image it replaces the text and pushes the text below it.

Screenshots : Before and After

CSS

body {
  background-color: #1a1a1a;
}
header,
h1 {
  text-align: center;
  font-family: CGF Locust Resistance;
  font-size: 50px;
  color: lightgray;
  -webkit-text-stroke: 1.5px #000;
}
header {
  margin: 0;
  padding: 0;
  height: 100px;
  border-bottom: .5px solid #b3b3b3;
}
nav {
  position: relative;
  top: -5px;
  margin: auto;
  padding: 0;
  list-style: none;
  width: 100%;
  text-align: center;
  border-bottom: .5px solid #b3b3b3;
}
nav ul li {
  display: inline;
  color: #fff;
  font-family: CGF Locust Resistance;
  font-size: 12.5px;
  padding: 20px;
}
.red {
  color: red;
}
#omen {
  z-index: -1;
}

Answer

Wim Mertens picture Wim Mertens · May 25, 2016

Set the image as a background-image of header. Is that what you're after?