| | |
How can I use CSS & div instead of table layouts in this case??
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 11
Reputation:
Solved Threads: 0
I want the height of the right side column (id="menu") stretch down automatically, when the amount of content on the left side (id="page00") makes the "page00" div taller than the "menu" div and/or viceversa. I mean when I enter text and image in "page00" div, I want the height of "menu" div increase dynamically and/or viceversa. Please note that these two divs are inside the "content" div and all of the divs are wrapped into a "wrap" div.
I have the option to use tables for my purpose but I want to get it done via divs and css.
Here is the codes I have used to build a layout for my website:
And The CSS file used is this (style.css) :
All of your suggestions, constructive critics and solutions are welcome. But I will be most pleased if someone does the favour to me and gives me the solution to my problem.
Thank you in advance
I have the option to use tables for my purpose but I want to get it done via divs and css.
Here is the codes I have used to build a layout for my website:
HTML and CSS Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="fa"> <!-- Meta information --> <head> <meta content="fa" http-equiv="Content-Language" /> <meta name="keywords" content="" /> <meta name="discription" content="" /> <meta name="author" content="" /> <title> </title> <link rel="stylesheet" type="text/css" href="Style.css" /> </head> <!-- Page body --> <body> <div id="wrap"> <div id="header"> <div id="logo"> <h1><a href="index.html" title="homepage"> Subject </a></h1> </div> </div> <div id="content"> <div id="menu"> <br /> </div> <div id="page00"> <br /> </div> </div> <div id="footer-pa"> <div id="footer"> </div> </div> </div> <body> </html>
HTML and CSS Syntax (Toggle Plain Text)
body { background: url("images/010.jpg") repeat; margin: 0; font-family: Tahoma; } #wrap { background-color: #ffffff; width: 820px; padding: 10px 0; margin: 10px auto; } #header { margin: 0 auto; width: 800px; height: 70px; background: #C0C0C0; border-bottom: 1px solid #000000; } #logo { float: left; margin: 30px 0 0 30px; cursor: default; } #logo a { color: #000000; text-decoration: none; } #content { width: 800px; height: inherit; margin: 0 auto; clear: both; } #page00 { float: left; width: 600px; height: 100%; background: #DCE9F5; margin: auto; } #menu { float: right; width: 200px; height: 100%; background: gray; margin: auto; } #footer-pa { padding-top: 5px; clear: both; } #footer { height: 40px; width: 800px; clear: both; margin: 0 auto; background: #C0C0C0; }
All of your suggestions, constructive critics and solutions are welcome. But I will be most pleased if someone does the favour to me and gives me the solution to my problem.
Thank you in advance
If you wish to have the page00 div stretch when you add contents to the menu div, place the menu div inside the page00 div itself. If you float the menu div, do not forget to clear it before leaving page00 div.
There are times that you better use divs, but there are also some times that you'll need tables. Choose what you think is the best solution and see whether you achieve what you wanted to.
There are times that you better use divs, but there are also some times that you'll need tables. Choose what you think is the best solution and see whether you achieve what you wanted to.
vish :-)
http://www.vishwebdesign.com/
http://www.vishwebdesign.com/
•
•
Join Date: Oct 2008
Posts: 11
Reputation:
Solved Threads: 0
Thank you vishwebdesign for the solution. this is a good maner I have never thought about before!!!
using this solution the height of "Page00" div depends on "menu" div but what if I want the "menu" div stretch down when I add content to "page00" div. I know I can include "page00" in "menu. but is there any way to have both of the specifications mentioned above at the same time !!??
using this solution the height of "Page00" div depends on "menu" div but what if I want the "menu" div stretch down when I add content to "page00" div. I know I can include "page00" in "menu. but is there any way to have both of the specifications mentioned above at the same time !!??
To understand you properly, what you are saying is that you would like your menu background (colour) to be the same height as the content (page001)?
If so, I would simply let my #content include the same background as my menu and position it accordingly.
e.g.
#content
{
width: 800px;
margin: 0 auto;
height:inherit;
background: gray;
}
If thats not you want to do, please try explain it a little better and I will assist you as neccesary.
All the best,
If so, I would simply let my #content include the same background as my menu and position it accordingly.
e.g.
#content
{
width: 800px;
margin: 0 auto;
height:inherit;
background: gray;
}
If thats not you want to do, please try explain it a little better and I will assist you as neccesary.
All the best,
Last edited by macneato; Oct 16th, 2008 at 5:01 am.
If this reply solved your problem, please add to my reputation and don't forget to mark this thread as solved.
•
•
Join Date: Oct 2008
Posts: 89
Reputation:
Solved Threads: 4
hmm ok buddy wht u can do is that keep the height style of that div to 100% so as teh left div will increase it will automatically increase with it
•
•
Join Date: Oct 2008
Posts: 89
Reputation:
Solved Threads: 4
ok buddy problem solved i have tested it.
thisis the css for it
what required was a style overide which is done by adding style tag in the div even with the presence of a class. take a look. its workin perfect for me
HTML and CSS Syntax (Toggle Plain Text)
<html xmlns="http://www.w3.org/1999/xhtml" lang="fa"> <!-- Meta information --> <head> <meta content="fa" http-equiv="Content-Language" /> <meta name="keywords" content="" /> <meta name="discription" content="" /> <meta name="author" content="" /> <title> </title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <!-- Page body --> <body> <div id="wrap"> <div id="header"> <div id="logo"> <h1><a href="index.html" title="homepage"> Subject </a></h1> </div> </div> <div id="content"> <div id="menu" style="height:100%"> <br /> </div> <div id="page00"> <p> </p> <p> </p> <p> </p> <p><br /> </p> </div> </div> <div id="footer-pa"> <div id="footer"> </div> </div> </div> <body> </html>
thisis the css for it
HTML and CSS Syntax (Toggle Plain Text)
body { background: url("images/010.jpg") repeat; margin: 0; font-family: Tahoma; } #wrap { background-color: #ffffff; width: 820px; padding: 10px 0; margin: 10px auto; } #header { margin: 0 auto; width: 800px; height: 70px; background: #C0C0C0; border-bottom: 1px solid #000000; } #logo { float: left; margin: 30px 0 0 30px; cursor: default; } #logo a { color: #000000; text-decoration: none; } #content { width: 800px; height: inherit; margin: 0 auto; clear: both; } #page00 { float: left; width: 600px; height: 100%; background: #DCE9F5; margin: auto; } #menu { float: right; width: 200px; background: gray; } #footer-pa { padding-top: 5px; clear: both; } #footer { height: 40px; width: 800px; clear: both; margin: 0 auto; background: #C0C0C0; }
what required was a style overide which is done by adding style tag in the div even with the presence of a class. take a look. its workin perfect for me
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: aligning boxes
- Next Thread: Need help. My CSS File appear Gray on applying
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





