473,378 Members | 1,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Inherit div height

HaLo2FrEeEk
404 256MB
Ok, here's my issue. I'm working on a site that uses divs. I absolutely hate divs, but that's what was requested for this project. The layout is a centered, fixed-width design. The header, menu, banner, content, and footer all go straight down the center. Along the edges is a shadow of sorts. Through the header, menu, and banner the shadow is continuous, but when it gets to the content it fades off.

I have the image that it's supposed to be using, and I set it as the background image of the to border divs. I set these divs to inherit their height from the parent div, which is set to 100% (the body, html{} CSS also has a height: 100%; attribute). Also inside the parent div is the actual content div, which is what ends up stretching the parent div's height. The problem is that the border divs are NOT stretching. They should, at least, be the same height as the content div, but they remain at 0px in height. I also tried setting height: 100% and that didn't do anything. The only way I can get them to show up is the set pixel values for their height, but I'd like to avoid that.

There's really not much more information I can get. The project I'm working on is...privelaged information, not released yet, so I can't link to an example, but I hope that someone can understand my issue and PLEASE help.
Jul 3 '10 #1
6 4532
drhowarddrfine
7,435 Expert 4TB
Try adding 'overflow:auto' to the div containing the background image that's not stretching.

If you hate div, do you hate p, too? They're just html elements that have been around for over 10 years.
Jul 3 '10 #2
HaLo2FrEeEk
404 256MB
I hate divs because I'm used to the bad way: tables. I ended up figuring it out by manually defining the pixel value height for the div, I figured that'd be the best way to do it, because the content might not always stretch far enough to show the entire background image.

And I do hate <p>, I never use it, though I probably should. I use span a lot, though.
Jul 3 '10 #3
TheServant
1,168 Expert 1GB
@HaLo2FrEeEk
When I started I too used tables. I spent a good year of my HTML practice using Strict HTML so that I could drum it into myself about what is the correct HTML. Doing this can be difficult at first, but you will become a better coder and use all the elements correctly, reducing errors resulting from browsers needing to fix your incorrect code.
Jul 9 '10 #4
HaLo2FrEeEk
404 256MB
Oddly my code that uses tables validates with the W3C HTML validator. It's HTML 4.01 though, not XHTML.
Jul 9 '10 #5
TheServant
1,168 Expert 1GB
@HaLo2FrEeEk
Using tables for layout is not incorrect, it's just bad practice. Using <span> out of <p> and the like is incorrect and bad practice. Anyway, upto you.
Jul 9 '10 #6
Another way you can use it more easily. try this method.
Expand|Select|Wrap|Line Numbers
  1. #headerWrap {
  2. width:100%; height:auto;
  3. background:url(shadow.png) repeat-x bottom left;
  4. }
  5. #header {
  6. width:100%; height:100px;
  7. }
  8. .
  9. .
  10. .
  11. <div id="headerWrap">
  12. <div id="header">
  13. ............
  14. ...........
  15. ......
  16. </div>
  17. </div>
  18.  
  19.  
this method might solve your problem. Try to learn new techniques instead of hating divs.
Jul 9 '10 #7

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

Similar topics

11
by: Jeff Thies | last post by:
I have a series of blocks that are float left that I need centered on the page. <div class="center" align="center"> <div style="width: 100 px;float: left">thumbnail 1</div> <div style="width:...
6
by: Fran¨ois de Dardel | last post by:
http://mapage.noos.fr/dardelf3/tintin/page3bits.html Can I center the series of thumbnails horizontally in the pages _and_ keep the "elastic arrangement" where the number of thumbnails adapts to...
3
by: Jonah Bishop | last post by:
I have a puzzling problem with centering text, and I'm hoping that someone here can help me out. First of all, let me state that I am using XHTML 1.0 Strict and CSS for all layout purposes (no...
7
by: Erik Schulp | last post by:
Hi all, I am trying to get a CSS defined layout to center on the page, have tried doing this with the <center></center> tags but than everything is centered, including text etc etc. What...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
6
by: Axel Siebenwirth | last post by:
Hi, as described at http://www.quirksmode.org/css/centering.html, I try to do to centering with my site. I did exactly as told on that page but it only seems to center horizontally. My site...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
11
by: Cartoper | last post by:
Here is the code: http://cartoper.ueuo.com/centering.htm How do I get the big blue buttons to center themselves on Firefox and Safari on this web site? I know that the layout is a bit...
1
by: =?Utf-8?B?ZnJhbmt5?= | last post by:
Hello, I've created a table that has two rows that are span across three columns. The third row has three columns, each with an image. The last row is also span accross three columns. The span...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.