简体   繁体   English

如何修复 div alignment 问题?

[英]How to fix div alignment issue?

I'm working on a website in which at the bottom you can see the three social media accounts it has, but with the following code, this is the output, but I don't know what's causing it.我正在开发一个网站,在该网站的底部您可以看到它拥有的三个社交媒体帐户,但是使用以下代码,这是 output,但我不知道是什么原因造成的。

问题。

As you can clearly see, there is a grey box going over the three boxes, and I don't know how to fix this.如您所见,三个框上方有一个灰色框,我不知道如何解决此问题。

 .container { width: 600px; height: 190px; background-color: #ff7675; padding-top: 20px; padding-left: 15px; padding-right: 15px; } #st-box { float: left; width: 180px; height: 160px; background-color: white; border: solid black; } #nd-box { float: left; width: 180px; height: 160px; background-color: white; border: solid black; margin-left: 20px; } #rd-box { float: right; width: 180px; height: 160px; background-color: white; border: solid black; }
 <div class="container"> <div id="st-box"> <iframe></iframe> </div> <div id="nd-box"> <iframe></iframe> </div> <div id="rd-box"> <iframe></iframe> </div> </div>

What can I do?我能做些什么?

You should style your iframes.你应该为你的 iframe 设置样式。 Here is some code that will help you on your way.这里有一些代码可以帮助你。

 iframe {
    display: block;
    width: 100%;
    border: 0;
  }

The iframes inside your inner divs are causing these strange-looking borders.内部 div 中的 iframe 导致了这些看起来很奇怪的边框。 You can style them with css aswell.您也可以使用 css 设计它们。

For example, you might want to give them:例如,您可能想给他们:

border:0;
width:100%;

The browser adds a default border to iframe.浏览器为 iframe 添加了默认边框。 Give border: 0 to the iframe.将边框:0 分配给 iframe。 Check screenshot.检查屏幕截图。

在此处输入图像描述

iframe { border: 0; }

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

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