CSS 将指定像素缩放为动态

CSS Scaling Specified Pixels to Dynamic

body {
  margin: 0;
  background-color: #2196F3;
}

.outer {
  height: 100vh;
}

.inner {
  width: 500px;
  height: 1000px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  background-color: #FF5722;
}
<div class="outer">
  <div class="inner"></div>
</div>

内部div与特定像素如何适合屏幕高度或宽度与CSS保持比例不变?

像这样?:

body {
  margin: 0;
  background-color: #2196F3;
}

.outer {
  height: 100vh;
  width: 100%;
}

.inner {
  width: calc(100% - 40px);
  height: calc(100% - 40px);
  background-color: #FF5722;
  margin-top: 20px;
  margin-left: 20px;
}
<div class="outer">
  <div class="inner"></div>
</div>