简体   繁体   English

ReactJS:如何在a内填充 <footer/> ?

[英]ReactJS: How to do padding inside a <footer/>?

I have a footer with a white background with a pink box image named pinkbox.png . 我有一个白色背景的页脚,上面有一个名为pinkbox.png的粉红色框图像。 Without any padding, the pink box image sits in the upper left corner touching the footer's border. 没有任何填充,粉红色的方框图像位于左上角,接触页脚的边框。

But to create some space between them, I did padding and the pink box gets pushed inside, but then a horizontal scroll bar appears, rather than just pushing the pink box image inside. 但是要在它们之间留出一些空间,我进行了填充,然后将粉红色的盒子推入了内部,但是随后出现了水平滚动条,而不仅仅是将粉红色的盒子图像推入了内部。

What could be the issue? 可能是什么问题? Thank you 谢谢

Here is the code: 这是代码:

#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;
  }
}

And in my component: 在我的组件中:

  render(){

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

Without padding:15px; padding:15px; :

在此处输入图片说明

With padding: 15px; padding: 15px; :

在此处输入图片说明

This should work... 这应该工作...

#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;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM