yaragallamurali Posted May 6, 2015 Share Posted May 6, 2015 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 More sharing options...
Ingolme Posted May 6, 2015 Share Posted May 6, 2015 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 More sharing options...
yaragallamurali Posted May 6, 2015 Author Share Posted May 6, 2015 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 More sharing options...
Ingolme Posted May 6, 2015 Share Posted May 6, 2015 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 More sharing options...
yaragallamurali Posted May 6, 2015 Author Share Posted May 6, 2015 (edited) 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 May 6, 2015 by yaragallamurali Link to comment Share on other sites More sharing options...
COBOLdinosaur Posted May 7, 2015 Share Posted May 7, 2015 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 More sharing options...
yaragallamurali Posted May 7, 2015 Author Share Posted May 7, 2015 The div is not floated or fixed. It is a normal block level div. Link to comment Share on other sites More sharing options...
COBOLdinosaur Posted May 7, 2015 Share Posted May 7, 2015 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 More sharing options...
yaragallamurali Posted May 8, 2015 Author Share Posted May 8, 2015 Thanks for your replies. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now