【问题标题】:ReactJS: How to do padding inside a <footer/>?ReactJS:如何在 <footer/> 中进行填充?
【发布时间】:2016-09-16 18:57:17
【问题描述】:

我有一个白色背景的页脚和一个名为pinkbox.png 的粉红色框图像。没有任何填充,粉红色的框图像位于左上角,接触页脚的边框。

但是为了在它们之间创建一些空间,我做了填充,粉红色的盒子被推到里面,但是随后出现了一个水平滚动条,而不是仅仅把粉色盒子的图像推到里面。

可能是什么问题?谢谢

代码如下:

#footer {
  background-color: white;
  z-index: 100;
  display: flex;
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100px;
  width: 100%;
//was trying to do padding: 15px; here

  .pink-box {
    width: 15;
    height: 15;
  }
}

在我的组件中:

  render(){

    return(
      <footer id="footer">
        <img
          className="pink-box"
          src="/img/pinkbox.png"
        />
      </footer>
    )
  }

没有padding:15px;

padding: 15px;:

【问题讨论】:

    标签: javascript html css reactjs react-jsx


    【解决方案1】:

    这应该可以...

    #footer {
      background-color: white;
      z-index: 100;
      display: flex;
      position: absolute;
      left: 0;
      bottom: 0;
      height: 100px;
      width: 100%;
      padding: 15px;
      box-sizing: border-box;
    
      .pink-box {
        width: 15;
        height: 15;
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-10-03
      • 1970-01-01
      • 2023-04-09
      • 2018-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-24
      • 1970-01-01
      相关资源
      最近更新 更多