user8183429
user8183429

Reputation: 21

How to remove white space between iframe and div

I'm trying to remove the white space between the iframe and div as I can. Initially there are a huge white space, but after adding in margin: 0px; to my iframe, div, and h1 for my div as well, the white space still remain but become smaller. Anyone know how to remove the strange white space?

enter image description here

iframe {
margin: 0px;
padding: 0px;
}

.footer {
margin: 0px;
padding: 0px;
line-height: 160px;
width: 100%;
color: white;
background-color: black;
}

.footer h1 {
margin: 0px;
padding: 0px;
}

Upvotes: 2

Views: 2345

Answers (2)

Dustin Poissant
Dustin Poissant

Reputation: 3418

Without seeing any actual code from you I can give my best guess but no promises.

First make sure that the margins on the children are 0. Then set the font size to 0 on the parent, and reset the font size to whatever you want (default = 16px) in the children. This will make the white space have no size.

HTML:

<div id="parent">
  <iframe>
  <p>Hello World</p>
</div>

CSS:

#parent {
  font-size: 0;
}
#parent > * {
  margin: 0;
  font-size: 16px;
}

But please update the question to include some example code so we can provide a more complete answer.

Upvotes: 4

Mamunur Rashid
Mamunur Rashid

Reputation: 742

Use Margin, Padding 0. ex:

 margin: 0;
 padding: 0;

in CSS. for both div and iframe

Upvotes: 1

Related Questions