长宽比

长宽比

postcss-aspect-ratio-mini

[aspectratio] {
  position: relative;
}
[aspectratio]::before {
  content: "";
  display: block;
  width: 1px;
  margin-left: -1px;
  height: 0;
}

[aspectratio-content] {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}
[aspectratio][aspect-ratio="188/246"] {
  aspect-ratio: "188:246";
}

编译出来:

[aspectratio][aspect-ratio="188/246"]:before {
  padding-top: 130.85106382978725%;
}
上一页