Answers for "css pseudo classes :before"

0

style pseudo element, style before, style after

<style>
div {
  width: 100px;
  height: 100px;
  position: relative;
  border: 1px solid black;
}

div:after {
  background-color: var(--my-color-var);
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
}
</style>
<div style="--my-color-var: orange;"></div>
Posted by: Guest on August-12-2021

Browse Popular Code Answers by Language