首页 > 解决方案 > 在css中将ch转换为Px

问题描述

注意:我尝试了与该主题相关的所有问题和答案。

我的问题非常简单明了1ch = how many px?

我的样品code

相关搜索文章

  1. 理解-css-units
  2. css 单位
  3. css-unit-conversion-calculator

标签: javascripthtmlcss

解决方案


1ch 将是 8px - 从下面的示例代码中得到这个:

.convertedDiv1 {
  height: 1ch;
  width: 1ch;
  background-color: red;
}

.convertedDiv2 {
  height: 2ch;
  width: 2ch;
  background-color: green;
}

.convertedDiv3 {
  height: 3ch;
  width: 3ch;
  background-color: blue;
}

div {
  margin-bottom: 12px;
}
<div class="convertedDiv1"></div>
<div class="convertedDiv2"></div>
<div class="convertedDiv3"></div>


推荐阅读