1

I've scoured StackOverflow for an answer, but nothing I've tried has worked.

I have a container div with three inner divs stacked vertically with varying heights. When my browser window is maximized, it looks fine. When I make the window smaller and scroll right horizontally, there is a section of white space. How can I get rid of it? Thank you all in advance!

body {
min-width: 100%;
}

div#outer {
display: block;
position: absolute;
min-width: 100%;
}

div#top {
left: 0;
top: 0;
height: 100px;
width: 100%;
position: relative;
display: block;
}

div#middle {
left: 0;
top: 0;
height: 600px;
width: 100%;
position: relative;
display: block;
}

div#bottom {
left: 0;
top: 0;
height: auto;
width: 100%;
position: relative;
display: block;
}

HTML:

<html>
<head>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="big">
    <div id="top">
    </div>

    <div id="middle">
    </div>

    <div id="bottom">
    </div>
</div>
</body>

Monica
  • 1,585
  • 3
  • 23
  • 34

2 Answers2

0

In the body, there are some default margins. You can remove everything like this:

body {
    min-width: 100%;
    margin: 0;
    padding: 0;
}

If you only want the sides' margin removed:

body {
    min-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

Does that work?

jackcogdill
  • 4,900
  • 3
  • 30
  • 48
0
html,body {
         margin: 0px;
         padding: 0px;
         overflow-x: hidden;
}
Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
  • 3
    Please don't post only code as answer, but also provide an explanation what your code does and how it solves the problem of the question. Answers with an explanation are usually more helpful and of better quality, and are more likely to attract upvotes. – Dima Kozhevin Jul 31 '20 at 10:29