| | |
Div percentage height, centered and scrolling... or not...
Please support our Site Layout and Usability advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2005
Posts: 4
Reputation:
Solved Threads: 0
Hello, I have a problem. I want a div element to be 90% the width of a cell in a table and 80% the height. The width bit works, but height doesnt.
I also want it to be centered in the cell. Doesnt work.
I also want there to be a verticle scrollbar when necessary.
so far i have:
#content {
height: 80%;
width : 90%;
margin-left: auto;
margin-right: auto;
padding: 5px;
text-align: center;
overflow: auto;
}
and I have set the html and body to have a 100% width and height.
The div scrolls in IE, but in firefox it expands downwards.
in firefox it is centered, but in IE it is not.
in firefox the height is auto (rather than 80%).
see http://www.nugit.co.uk/?dirr=1Home%2...rs%2F2Portable
Thanks in advance.
I also want it to be centered in the cell. Doesnt work.
I also want there to be a verticle scrollbar when necessary.
so far i have:
#content {
height: 80%;
width : 90%;
margin-left: auto;
margin-right: auto;
padding: 5px;
text-align: center;
overflow: auto;
}
and I have set the html and body to have a 100% width and height.
The div scrolls in IE, but in firefox it expands downwards.
in firefox it is centered, but in IE it is not.
in firefox the height is auto (rather than 80%).
see http://www.nugit.co.uk/?dirr=1Home%2...rs%2F2Portable
Thanks in advance.
style and script tags should be in the head section of your document.
Clear up your validation errors and it should start working in more browsers.
http://validator.w3.org/check?uri=ht...%252F2Portable
Stylesheets should have a .css extension.
<link rel="stylesheet" type="text/css" href="style.php">
http://jigsaw.w3.org/css-validator/v...%252F2Portable
Clear up your validation errors and it should start working in more browsers.
http://validator.w3.org/check?uri=ht...%252F2Portable
Stylesheets should have a .css extension.
<link rel="stylesheet" type="text/css" href="style.php">
http://jigsaw.w3.org/css-validator/v...%252F2Portable
Your 100%s and your entire font families should not be in quotes.
width: 100%;
not
width: "100%";
That was the only error flagged on the css sheet. The three warnings are there I think because you have all your fonts in one quotation. You can have them individually in quotes, but not the whole lot. You don't usually need them tho.
width: 100%;
not
width: "100%";
That was the only error flagged on the css sheet. The three warnings are there I think because you have all your fonts in one quotation. You can have them individually in quotes, but not the whole lot. You don't usually need them tho.
![]() |
Similar Threads
- Getting the height and width of content fitting DIV element. (JavaScript / DHTML / AJAX)
- createElement wont show table/div (JavaScript / DHTML / AJAX)
- I need to grab the height of a div. (JavaScript / DHTML / AJAX)
- iframe help - Height (HTML and CSS)
- spyware has taken control of my pc (Viruses, Spyware and other Nasties)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: Daniweb navigation issues
- Next Thread: Do I need Breadcrumbs?
| Thread Tools | Search this Thread |
blogging content customer design development dreamweaver duplicate email evaluation filesharing firefox flash gilbane google html itunes javascript kazaa layout music napster peertopeer photoshop remote remoteserver satellitenavigation satnav server site tables template tips tomtom url wave web website websitedesignreview web_development web_sites





