Jump to content

growing body according to the div width


yaragallamurali

Recommended Posts

I have a html page. the body and html tags are set to 100% width and height. Now the html is up to the size of browser window.

 

but i have a div in my body which is greater than the screen width(browser window). So scrollbars are appearing. this is fine but body is not growing according to the width of the div. how to solve this problem?

Link to comment
Share on other sites

If you set the body to 100%, then it will not get any larger than the size of the window. If you want it to be larger, then remove the width: 100% declaration from your CSS.

 

By default, the body element already occupies a minimum of 100% of the width of the window.

Link to comment
Share on other sites

If you set the body to 100%, then it will not get any larger than the size of the window. If you want it to be larger, then remove the width: 100% declaration from your CSS.

 

By default, the body element already occupies a minimum of 100% of the width of the window.

I have removed width 100% from css but still the width of the body is not growing up to the width of the div which is greater than the screen size.

Link to comment
Share on other sites

Perhaps there's another element that has a fixed width that is a parent of the div.

 

How do you know the body isn-t expanding? Is it because of a background or something?

Link to comment
Share on other sites

Perhaps there's another element that has a fixed width that is a parent of the div.

 

How do you know the body isn-t expanding? Is it because of a background or something?

i am checking with developer tools of the browser and also my header which is included in html does not grow to the div width. if i grow the body size by specifying width in pixels then everything is fine but i want to grow it automatically.

Edited by yaragallamurali
Link to comment
Share on other sites

If the div is floated, position absolute, or position:fixed, then it would be outside of the normal flow and it parent (in this case the body) would not respond as if the div is contained within it.

 

However the most like cause is the markup itself. The validator reports 222 errors and a number of them are serious structural defects:

 

http://validator.w3.org/check?uri=http%3A%2F%2Fyaragalla.blogspot.in%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

 

I suggest you try fixing the structural errors, so that you at least have a valid stable platform to work on.

Link to comment
Share on other sites

Then it is the abudance of errors that have made it impossible for the browser to comprehend what it is that you expect it to render.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...