<h2 class="title-a">Title with backgroud and shadow</h2>
<h2 class="title-b">Title with backgroud and shadow</h2>
<h2 class="title-c"><span>Title with line</span></h2>

<div class="black">
<h2 class="title-d">Title with colorful bar</h2>
</div>
<h2 class="title-e">Title with colorful bar</h2>
<h2 class="title-f">Tag Title</h2>
.title-a {
  padding: 1rem 2rem;
  color: #fff;
  background: #049;
  -webkit-box-shadow: 5px 5px 0 #003270;
  box-shadow: 5px 5px 0 #003270;
}

.title-b {
  position: relative;
  padding: 1rem 2rem calc(1rem + 10px);
  background: #fff100;
}

.title-b:before {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 100%;
  height: 100%;
  content: '';
  border: 4px solid #000;
}
.title-c {
  position: relative;
  padding: 0 65px;
  text-align: center;
}
.title-c:before {
  position: absolute;
  top: calc(50% - 1px);
  left: 0;
  width: 100%;
  height: 2px;
  content: '';
  background: #000;
}
.title-c span {
  position: relative;
  padding: 0 1em;
  background: #fff;
}
.black {
  background: #000;
}
.title-d {
  position: relative;
  padding: 1rem .5rem;
  color: #fff;
}

.title-d:after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  content: '';
  border-radius: 3px;
  background-image: -webkit-linear-gradient(20deg, yellow, blue, orange, purple, green, red);
  background-image: linear-gradient(70deg, yellow, blue, orange, purple, green, red);
}

.title-e {
  font-family: 'ヒラギノ明朝 Pro W3', 'Hiragino Mincho Pro', 'Hiragino Mincho ProN', 'HGS明朝E', 'MS P明朝', serif;
  position: relative;
  padding: 1.5rem 2rem;
  -webkit-box-shadow: 0 2px 14px rgba(0, 0, 0, .1);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .1);
}

.title-e:before,
.title-e:after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  content: '';
  background-image: -webkit-linear-gradient(315deg, #704308 0%, #ffce08 40%, #e1ce08 60%, #704308 100%);
  background-image: linear-gradient(135deg, #704308 0%, #ffce08 40%, #e1ce08 60%, #704308 100%);
}

.title-e:before {
  top: 0;
}

.title-e:after {
  bottom: 0;
}

.title-f {
  position: relative;
  display: inline-block;
  height: 32px;
  margin-left: 30px;
  padding: 1rem 2rem 1rem 3rem;
  color: #fff;
  background: #fa4141;
}

.title-f:before {
  position: absolute;
  top: 0;
  left: -30px;
  content: '';
  border-width: 32px 30px 32px 0;
  border-style: solid;
  border-color: transparent #fa4141 transparent transparent;
}

.title-f:after {
  position: absolute;
  top: calc(50% - 7px);
  left: -10px;
  width: 14px;
  height: 14px;
  content: '';
  border-radius: 50%;
  background: #fff;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.