html - Webkit 转换缩放问题

标签 html css css-transforms

面对缩放问题,如何移除两个 span 元素之间的额外空间。

我无法根据要求添加额外的标签。在 span 标签中如何解决这个问题。

span {
  -webkit-transform-origin-x: 0%;
  -webkit-transform-origin-y: 0%;
}

拆分跨度之前

    <p style="margin: 0.0px 0.0px 0.0px 0.0px; ">
        <span style="font-size: 14pt; color: #000000; letter-spacing: 0pt; text-transform: none; text-align: left; text-decoration: none; word-spacing: 1.33pt; -webkit-transform: scale(0.7,1); -moz-transform: rotate(0deg); -o-transform: rotate(0deg); text-shadow: none; display: inline-block; white-space: nowrap ;width:auto;height:auto;">Keebler Zesta Saltine Crackers</span>
    </p>

拆分 span 前的屏幕截图

enter image description here

拆分跨度后

    <p style="margin: 0.0px 0.0px 0.0px 0.0px; ">
        <span style="font-size: 14pt; color: #000000; letter-spacing: 0pt; text-transform: none; text-align: left; text-decoration: none; word-spacing: 1.33pt; -webkit-transform: scale(0.7,1); -moz-transform: rotate(0deg); -o-transform: rotate(0deg); text-shadow: none; display: inline-block; white-space: nowrap ;width:auto;height:auto;">Keebler Zesta Saltine</span><span style="font-size: 14pt; color: #000000; letter-spacing: 0pt; text-transform: none; text-align: left; text-decoration: none; word-spacing: 1.33pt; -webkit-transform: scale(0.7,1); -moz-transform: rotate(0deg); -o-transform: rotate(0deg); text-shadow: none; display: inline-block; white-space: nowrap ;width:auto;height:auto;"> Crackers</span>
    </p>

拆分 span 后的屏幕截图

enter image description here

最佳答案

缩放容器

p {
     -webkit-transform: scale(0.7, 1);
     transform: scale(0.7, 1);
}
    <p style="margin: 0.0px 0.0px 0.0px 0.0px; ">
        <span style="font-size: 14pt; color: #000000; letter-spacing: 0pt; text-transform: none; text-align: left; text-decoration: none; word-spacing: 1.33pt; text-shadow: none; display: inline-block; white-space: nowrap ;width:auto;height:auto;">Keebler Zesta Saltine</span>
      <span style="font-size: 14pt; color: #000000; letter-spacing: 0pt; text-transform: none; text-align: left; text-decoration: none; word-spacing: 1.33pt;  text-shadow: none; display: inline-block; white-space: nowrap ;width:auto;height:auto;"> Crackers</span>
    </p>

如果您只计划 2 个跨度,则可以使用容器的全局比例、第二个跨度的比例来对齐它们,并将变换原点设置在左侧,这样它们之间的间距就不会改变。

请注意,第二个跨度的总比例是两个变换的组合

p {
  font-size: 40px;
  transform: scale(0.5, 1);
}
.test {
  transform: scale(2, 1);
  transform-origin: left center;
  display: inline-block;
}
<p>
  <span>Keebler Zesta Saltine</span>
  <span class="test">Crackers</span>
</p>

关于html - Webkit 转换缩放问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39789653/

相关文章:

html - 如何在左上角或右上角旋转和定位元素?

php - 使用 PHP 在 dom 中移动标签/元素

html - :hover not working

mobile-safari - Mobile Safari 中的 2D 转换硬件是否加速?

jquery - 在 jQuery 中添加 inset 到 box-shadow 属性以动态更新

html - 在不破坏布局的情况下,无法让我的页眉与页面顶部齐平

css - 在样式表中堆叠来自多个选择器的 CSS3 转换函数

javascript - PHP多种表单重新提交避免

javascript - 挖空标签装订

javascript - 将 MediaRecorder 音频转换为 base64