<div class="container">
  <p class="text">
    Этот блок содержит различные псевдоэлементы
  </p>
</div>
.container {
  box-sizong: border-box;
  width: 250px;
  margin: 10px auto;
  padding: 20px;
  border: 4px solid gray;
  font-size: 16px;
  line-height: 20px;
}

.container::before {
  content: "::before";
}
.container::after {
  content: "::after";
}

.container::before,
.container::after {
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 10px;
  background: coral;
  color: white;
  font-weight: 700;
  text-align: center;
}

.text {
  margin: 20px 0;
}

.text::first-letter {
  color: coral;
  font-size: 20px;
}

.text::first-line {
  color: gray;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.