473,748 Members | 10,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Div heights css

3 New Member
I am having problems with divs and height. I notice this is a very common problem, I have tried many of the fixes and I am still running into problems.

I am working on this page.

My problem is the Div columns will not stretch to 100%, or 100% seems to be the users screen height and not the content height. I would like all the columns to stretch to the height of the page content.

http://www.rewitec.ca/index.php?CategoryID=53

I am using an external style sheet.

Here is the code:

Expand|Select|Wrap|Line Numbers
  1. /************ PAGE LAYOUT *****************************/
  2.  
  3. html,body {
  4.  
  5. float:left;
  6. background-image: url(images/background.png);
  7. background-repeat: repeat;
  8. height: 100%;
  9. margin:0;
  10. padding:0; 
  11.  
  12. }
  13.  
  14. /************ HEADER **********************************/
  15.  
  16. #header {
  17.  
  18. float: left;
  19. width: 100%;
  20. height: 114px;;
  21. background-image: url(images/h_spacer.png);
  22. background-repeat: repeat-x;
  23. background-position: top;
  24.  
  25. }
  26.  
  27.  
  28. #headerpic {    
  29.  
  30. background-attachment:fixed;
  31. background-position: top, center;
  32.  
  33. }
  34.  
  35.  
  36. /************  HORIZONTAL NAVIGATION BAR *************/
  37.  
  38. #h_Nav {
  39.  
  40. float: left;
  41. width: 100%;
  42. display: inline;
  43.  
  44. background-color: rgb(60,60,60);
  45.  
  46. margin-bottom: 3px;
  47.  
  48. }
  49.  
  50. /*********** LOGIN FORM **************************************/
  51.  
  52. .Login {
  53.  
  54. float: right;
  55. width: 100%;
  56.  
  57. text-align: right;
  58. text-decoration: none;
  59. font-family: tahoma;
  60. font-size: 10;
  61. font-weight: bold;
  62. color: white;
  63.  
  64. }
  65.  
  66. .LoginButton {
  67.  
  68. background-color: rgb(68, 84, 108);
  69. text-align: center;
  70. text-decoration: none;
  71. font-family: tahoma;
  72. font-size: 9;
  73. color: white;
  74.  
  75.  
  76. }
  77.  
  78. .LoginTextbox {
  79.  
  80. text-decoration: none;
  81. font-family: tahoma;
  82. font-size: 9;
  83. font-weight: bold;
  84. color: black;
  85.  
  86.  
  87. }
  88.  
  89.  
  90.  
  91.  
  92. /************ PAGE BODY ************************************/
  93.  
  94. #border_left{
  95. float: left;
  96. width: 33px;
  97. height: 100%;
  98. background-image: url(images/border_left.png);
  99. background-repeat: repeat-y;
  100. background-position: top;
  101.  
  102. }
  103.  
  104. #border_right{
  105. float: left;
  106. width: 46px;
  107. height: 100%;
  108. background-image: url(images/border_right.png);
  109. background-repeat: repeat-y;
  110. background-position: top;    
  111.  
  112. }
  113.  
  114.  
  115. #ContentBody {
  116.  
  117. float: left;
  118. width: 692px;
  119. height: 100%;
  120. background-color: rgb(255,255,255);
  121. }
  122.  
  123.  
  124. #TextContent {
  125.  
  126. background-color: rgb(255,255,255);
  127. height: 100%;
  128. margin-top: 8px;
  129. margin-right: 8px;
  130. margin-bottom: 8px;
  131. margin-left: 8px;
  132. }
  133.  
  134.  
  135. /*********** VERTICLE NAVIGATION ******************************/
  136.  
  137. #v_NavBody {
  138.  
  139. float: left;
  140. width: 150px;
  141. height: 100%;
  142. background-color: rgb(69,147,216);
  143.  
  144. }
  145.  
  146. .v_Nav {
  147.  
  148.  background-color: rgb(0,0,0);
  149.  text-decoration: none;
  150.  font-family: tahoma;
  151.  font-size: 12;
  152.  font-weight: bold;
  153.  color: white;
  154.  
  155. }
  156.  
  157. .v_SubNav {
  158.  
  159.  background-color: rgb(255,255,255);
  160.  text-decoration: none;
  161.  font-family: tahoma;
  162.  font-size: 12;
  163.  font-weight: bold;
  164.  color: black;
  165.  
  166.  
  167. }
  168.  
  169.  
  170. form {
  171.   margin-top: -1em;
  172.   margin-bottom: 0;
  173.   display: inline;
  174.  } 
  175.  
Here is the page code:
[html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Rewite c Canada</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href='style.css ' rel='stylesheet ' type='text/css'>
</head>
<body>


<div id='header'><di v id='headerpic'> <img src='images/header.png' alt='Rewitec Canada'></div></div>
<div id='border_left '></div>

<div id='v_NavBody'> TEXT</div>

<div id='ContentBody '>
<div id='h_Nav'>TEXT </div>
TEXT
</div>


<div id='border_righ t'></div>
</body>
</html>
[/html]

please take a look at this category on the page in both FF and IE.

Where am I going wrong

Thank you for any help
Mar 15 '08 #1
4 1453
drhowarddrfine
7,435 Recognized Expert Expert
When you use percentage, the question to ask is "Percent of what?" Normally it would be the percent of the containing/parent element. But, if so, what is the size of that parent? That needs a defined size and, if it, too, is in percent then...percent of what?

In your case, you show the html, body and other elements set to float. Floating removes that element from the normal flow and some of them may be losing their reference point. Try to let elements fall where they may without positioning them and decrease the need to float everything.

Your doctype is incorrect and IE will go into quirks mode. Use this one:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

These CSS errors need fixing.
Mar 15 '08 #2
Rinventive
3 New Member
Thanks for the quick reply.

I'll fix these problems to the best of my ability. Wow changing the doctype has mixed everything up, this might take a bit.

Again thank you. I'm sure I'll be back with more questions shortly.
Mar 15 '08 #3
drhowarddrfine
7,435 Recognized Expert Expert
The reason things change is because we are changing the rules. No doctype means rendering in quirks, which is so 20th century. Current standards require the doctype I showed you. For more info, see the article about doctypes in the Howto section above.
Mar 15 '08 #4
Rinventive
3 New Member
I have fixed the errors and the page is now layed out correctly in FF and IE.

The last problem I am have is how do I make my left and right borders and nav_body height relative to the content height.

I am new to css (I'm sure you noticed)

I'm not sure where to begin fixing this. I have removed the height: 100% from the body and this seems to allow the content div to stretch correctly, but leaves my #border_left, #border_right and #v_NavBody from showing..does not stretch to the content height.

Sorry to be such a newb with css, but I'm learning.

If the percent is based on the parent container, This means that I need to create a container that holds all the columns and have that stretch to fit the content? ....making all the columns stretch to fill this container ?
Mar 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5325
by: Tyler Carver | last post by:
I am trying to create a table that 100% of the viewport with three rows. The top and bottom rows have a fixed height and the center row I want to take up the rest of the space. This work fine in Mozilla but I cannot control the row height exactly in IE. They work like min-heights. Here is the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head>
1
2434
by: Tyler Carver | last post by:
I am trying to create a table that is 100% of the viewport with three rows. The top and bottom rows have a fixed height and the center row I want to take up the rest of the space. This work fine in Mozilla and Opera but I cannot control the row height exactly in IE. Row heights are working more like min heights. Here are two examples. http://hughaxton.com/newsgroups/IETableRowHeight.html This one shows the height of the table at...
3
4391
by: cpt | last post by:
I read that if one uses "table-layout:fixed" then table rendering is speeded by setting row height. All my rows are 285 px high. 1) Is this true? 2) If true, how does one set row-height for the table, preferable with a CSS style? Thanks, CMA
7
2329
by: lauren quantrell | last post by:
A while back I got a requirement for the client to be able to adjust the relative heights of two subforms by click-dragging the mouse and I came up with a kludge solution using a border control between the two subforms. But I put my mind to this again recently and came up with a solution (code below) that works well with multiple subforms to size both the heights and widths of the sunforms relative to each other, and it uses no additional...
1
7599
by: Beringer | last post by:
Does anybody know a way to get the heights of the various lines of text in a RichTextBox? I'm not sure if "height" is the proper term. But what I'm getting at is that if you set the font size of some selected text on a line the entire line "height" expands to the new font size. I want that!
1
1339
by: tshad | last post by:
Why are the text box heights of the input/file type textbox for uploading files a smaller height than a normal textbox? They have the exact same font and the same size font. But the heights are smaller for the upload textbox for some reason. I wanted to make them look the same, but can't figure out how to change them - or can you?
2
2407
by: sfeher | last post by:
Hi All, I am having trouble big times figuring out a way of forcing a DIV to be in synch with another DIV's height in a (mostly vertically) fluid layout in a web app context. The first one has overflow-x:auto; and a width set but not a height as I want it to vertically grow with the text inside. Basically I would like the same height for the second one. I care less if it is CSS, tables or Javascript but I would prefer the solution to
7
3014
by: hestres | last post by:
Hello, I'm having trouble figuring out how to make sure that all my DIVs in this layout are of the same height. Here's an example of a page where I'm having this problem: http://www.house.gov/velazquez/test/issues/index.html As you can see, the main content column (the white one) cuts off while the sidebar (yellow) keeps going. I want the white column to be the
5
6686
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to be able to increase or decrease row heights of a populated DataGridView from the keyboard. I set up a test program with menu items to increase and decrease, assigned shortkey keys (ctrl-UpArrow and ctrl-DnArrow), and attached handlers that execute this code: public partial class MainForm : Form { . . . dataGridView.RowTemplate.Height += increment; Refresh();
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.