-1

The right side of the container runs out of the browser and a scroll-bar shows up.

How can i adjust to be just fit in the browser? And the bottom does not reach the bottom of the browser... Any idea?

.container {
  border: 1px solid #ffffff;
  margin-top: 60px;
  margin-left: 200px;
  min-width: 100%;
  min-height: 100%;
  position: absolute; 
}
K Scandrett
  • 16,390
  • 4
  • 40
  • 65
vinya
  • 11
  • 4

3 Answers3

1

You have set min-width: 100% AND margin-left: 200px which ends up in a total of 100% + 200px, which ends with a horisontal scrollbar.

If you WANT the margin, AND the size to be the rest of the size of the window, you can do this: max-width: calc(100% -200px); and just keep the rest the same.

Only works in relatively new browsers.

junkfoodjunkie
  • 3,168
  • 1
  • 19
  • 33
1

Use min-width: calc(100% - 202px); to include the margin and borders you defined in the width.

For height, make sure all parent elements have defined heights, which can also mean you have to add body, html: height: 100%; . In this case also add box-sizing: border-box;, but then the width setting above should be min-width: calc(100% - 200px);, since border-box already includes the border in the width.

Johannes
  • 64,305
  • 18
  • 73
  • 130
1

if You Use border with width:100% then you have to use box-sizing:border-box;

position: absolute;
top: 60px;
left:0px;
min-width: 100%;
min-height: 100%;
border: 1px solid #ffffff;
background:red;
box-sizing:border-box;