skip to Main Content

I have this CSS code, my problem is that because of the padding-top (to have some space from the top) my page is too big what makes it to have ‘scroll’ option and it doesn’t fit the whole screen.

How do I make it so the scroll option will be disabled?

* {
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}
body {
    color: #444;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f7f7;
}
.container {
    margin: 0 auto;
    width: 100%;
    height: 100%;
    padding-top: 20px;
}

I tried to add overflow: hidden; which works but then it cuts off some of my divs at the bottom

2

Answers


  1. Add box-sizing: border-box; to .container to include the padding in the percentage value for height.

    Login or Signup to reply.
  2. Relys. You can using the

    box-sizing: border-box

    on your container div to include your padding.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search