<header></header>

css样式:

* {
  margin: 0;
  padding: 0;
}

header {
  width: 100%;
  height: 50px;
  background-color: #1c2327;
  position: relative;
}

header::before {
  content: '';
  width: 100%;
  height: 5px;
  background-image: linear-gradient(to left, green, blue, skyblue, red, pink);
  position: absolute;
  left: 0;
  right: 0;
}

代码演示:

202101211611212944779878