Skip to main content

Tedshd's Dev note

CSS - SASS handle index

Table of Contents

# CSS - SASS handle index

Can use var control z-index

$elements: con, slider, masthead;

.masthead {
  /* z-index: 3 */
  z-index: index($elements, masthead);
}

.slider {
  /* z-index: 2 */
  z-index: index($elements, slider);
}

.con {
  /* z-index: 1 */
  z-index: index($elements, con);
}

Refer - 使用 sass 有效控管 z-index 圖層順序