Ben Hathaway
Ben Hathaway

Reputation: 356

Setting website height css

I am currently creating a website and i'm trying to fix the max height to 1100px. However if i try do this i get 2 scroll bars coming up assuming because of the div. Could anyone help me? here is a snippet of my code.

CSS:

html, body {
  border:0;
  margin:0;
  padding:0;
  overflow-x: hidden;
}

#wrap { 
    width: 960px; 
    margin: 0 auto; 
}

Upvotes: 0

Views: 103

Answers (1)

BenM
BenM

Reputation: 53228

Just use the max-height property on the your #wrap element. It might also be advisable to move the overflow-x property, and change it to overflow-y, or simply overflow too:

html, body {
    border:0;
    margin:0;
    padding:0;
    overflow-x: hidden;
}

#wrap { 
    width: 960px; 
    margin: 0 auto; 
    overflow: hidden;
    max-height: 1100px;
}

See this jsFiddle Demo

Edit:

I have added overflow-y to the html, body definition to prevent the default viewport scrollbar from showing.

Upvotes: 1

Related Questions