CSS → Overlay без дополнительных html элементов

21.11.2014

Пример вывода оверлея на чистом css:

body.overlay:before {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(0, 0, 0, .5);
  z-index: 100;
}

Демо.

Можно добавить прелоадер:

body.preloader:after {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55px;
  width: 55px;
  margin: auto;
  background: white url(preloader.gif) no-repeat center center;
  border-radius: 6px;
  z-index: 101;
}

Демо.

Другие способы вывести оверлей.

Похожие записи

Добавить комментарий