代码之家  ›  专栏  ›  技术社区  ›  János

边距在Safari显示中不起作用:绝对div

  •  0
  • János  · 技术社区  · 4 年前

    我有以下HTML:

    <div className={styles.checkBox}>
      {((props.itemsWithSelection &&
        props.itemsWithSelection?.[key] == 1) ||
        (!props.itemsWithSelection &&
          invoiceItemsIncluded2[key].defaultValue == 1)) && (
        <Check2 className={styles.checked} />
      )}
    </div>
    

    还有css:

    .checkBox {
      background-color: #12341b;
      top: 30px;
      left: 170px;
      height: 60px;
      width: 60px;
      position: absolute;
      transition: 0.2s;
      z-index: 5;
    }
    
    .checked {
      color: white;
      padding: 10px;
    }
    

    在Chrome中,checkmarkicon居中得很好,但在Safari中却没有,为什么?

    如果我不使用任何填充物(10px),那么它看起来不错。

    enter image description here

    0 回复  |  直到 4 年前