473,765 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to inherit the height of a div tag to other 2 div tag height as (inherit) ?

50 New Member
hey i am just beginner in CSS.I have attached the screen shoot. In this the Left-side inherit height of the main content but when i try to inherit for Right-side it don't work help me.

This is the HTML code inside body tag.
Expand|Select|Wrap|Line Numbers
  1. <div id="container">
  2. <div id="header"><form action="logout.php" method="post"><p align="right"><input type="submit" name="signout" value="Sign Out" /></p></form></div>
  3.  
  4. <div class="main_panel_top_left"></div>
  5. <div class="main_panel_top_center"><cite>Maga</cite>ssss</div>
  6. <div class="main_panel_top_right"></div>
  7.  
  8. <div class="float_clear"></div>
  9.  
  10.  
  11. <div class="main_panel_middle_left"></div>
  12.  
  13. <div class="main_panel_middle_center">
  14.  
  15.             <div class="wrapper_top_left"></div>
  16.  
  17.             <div class="wrapper_top_center"></div>
  18.  
  19.             <div class="wrapper_top_right"></div>
  20.  
  21.  
  22.  
  23.     <div class="wrapper_middle_left">
  24.  
  25.     <div class="wrapper_middle_center">
  26.  
  27.     <h2>HTML to Forget</h2>
  28.     <p>CSS lets you write simpler HTML for one big reason: You can stop using a bunch
  29.       of tags and attributes that only make a page better looking. The <font> tag is the
  30.       most glaring example. Its sole purpose is to add a color, size and font to text. It
  31.       doesn't do anything to make the structure of the page more understandable.
  32.       Here's a list of tags and attributes you can easily replace with CSS:
  33.       • Ditch <font> for controlling the display of text. CSS does a much better job
  34.       with text. (See Chapter 6 for text-formatting techniques.)
  35.       • Stop using <b> and <i> to make text bold and italic. CSS can make any tag
  36.       bold or italic, so you don't need these formatting-specific tags. However, if you
  37.       want to really emphasize a word or phrase, then use the <strong> tag (browsers
  38.       display <strong> text as bold anyway). For slightly less emphasis, use the <em>
  39.       tag (browsers italicize content inside this tag). 
  40.      </p>
  41.  
  42. </div> <div class="wrapper_middle_right" >
  43.       </div>  
  44.      </div>  
  45.  
  46.  
  47.  
  48.  
  49.     <div class="wrapper_bottom_left"></div>
  50.  
  51.     <div class="wrapper_bottom_center"></div>
  52.  
  53.     <div class="wrapper_bottom_right"></div>
  54.  
  55. </div>
  56.  
  57. <div class="main_panel_middle_right"></div>
  58.  
  59. <div class="float_clear"></div>
  60.  
  61. <div class="main_panel_bottom_left"></div>
  62.  
  63. <div class="main_panel_bottom_center"></div>
  64.  
  65. <div class="main_panel_bottom_right"></div>
  66.  
  67. <div class="float_clear"></div>
  68. <div id="footer" align="center"><address>Copyright © 2011 XXXXXXXX. All rights reserved.</address> </div>
  69. </div>
  70.  
This is CSS code

Expand|Select|Wrap|Line Numbers
  1. #container{    
  2.     margin-top: 10px;
  3.     margin-left:10%;
  4.     margin-right:10%;
  5.     margin-bottom: 10px;
  6.     background-color:#FFF;
  7.     width:995px;/*80%;*/
  8.     height:100%;
  9. }
  10.  
  11. #header{
  12.     height:20px;
  13.     padding:20px;
  14.  
  15. }
  16. #footer{    
  17.  
  18. }
  19. /*              main gray panel layout                         */
  20.  
  21. /* top layout */
  22.  
  23. .main_panel_top_left{
  24.     float:left;
  25.     background-image:url(images/wrapper_topl.png);
  26.     width:8px;
  27.     height:51px;
  28.  
  29. }
  30. .main_panel_top_center{
  31.     float:left;
  32.     background-image:url(images/wrapper_top.png);
  33.     background-repeat:repeat-x;
  34.     height:51px;
  35.     width:975px;
  36.  
  37. }
  38. .main_panel_top_right{
  39.     float:left;
  40.     background-image:url(images/wrapper_topr.png);
  41.     width:8px;
  42.     height:51px;
  43. }
  44.  
  45.  
  46. /* middle layout */
  47.  
  48. .main_panel_middle_left{
  49.     float:left;
  50.     background-image:url(images/wrapper_10.png);
  51.     width:8px;
  52.     background-repeat:repeat-y;
  53.  
  54.     height:inherit; /* i want it to auto or inhert*/
  55.     /*height:250px;*/    
  56.     /* height:317px;*/
  57.  
  58. }
  59. .main_panel_middle_center{
  60.     float:left;
  61.     width:975px;
  62.     height:inherit;
  63.  
  64. }
  65. .main_panel_middle_right{
  66.  
  67.     float:left;
  68.     background-image:url(images/wrapper_15.png);
  69.     width:8px;
  70.     background-repeat:repeat-y;
  71.     height:inherit; /* i want it to auto or inhert*/
  72.     /*height:317px;*/    
  73.     /*    height:250px; */
  74. }
  75.  
  76. /* bottom layout */
  77.  
  78. .main_panel_bottom_left{
  79.     float:left;
  80.     background-image:url(images/wrapper_bottoml.png);
  81.     width:8px;
  82.     height:41px;
  83. }
  84. .main_panel_bottom_center{
  85.         float:left;
  86.     background-image:url(images/wrapper_bottom.png);
  87.     background-repeat:repeat-x;
  88.     height:41px;
  89.     width:975px;
  90. }
  91. .main_panel_bottom_right{
  92.         float:left;
  93.     background-image:url(images/wrapper_bottomr.png);
  94.     width:8px;
  95.     height:41px;
  96. }
  97. /*              main gray panel layout  end                       */
  98.     #box{
  99.         float:left;
  100.         padding-right:20px;
  101.         padding-left:20px;
  102.     }
  103.  
  104.     .float_clear{
  105.     clear:both;
  106.     }
  107.  
  108.  
  109. /*                   inner gray panel wrapper                                 */    
  110.  
  111. .wrapper_top_left{
  112.     float:left;
  113.     background-image:url(images/wrapper_11.png);
  114.     width:4px;
  115.     height:12px;
  116.  
  117. }
  118.  
  119. .wrapper_top_center{
  120.     float:left;
  121.     width:967px;
  122.     height:4px;
  123. }
  124.  
  125. .wrapper_top_right{
  126.     float:left;
  127.     background-image:url(images/wrapper_14.png);
  128.     width:4px;
  129.     height:12px;
  130. }
  131.  
  132. .wrapper_middle_left{
  133.  
  134.     float:left;    
  135.     background-image:url(images/wrapper_17.png);
  136.     width:4px;
  137.     /*height:300px; 233px;*/
  138.     height:inherit; /* i want it to auto or inhert*/
  139.     background-repeat:repeat-y;
  140.  
  141. }
  142.  
  143. .wrapper_middle_center{
  144.     padding:5px;
  145.  
  146.     float:left;
  147.     width: 940px;/*99.2%;*/
  148.     min-width:600px;
  149.  
  150. }
  151.  
  152. .wrapper_middle_right{
  153.     float:right;
  154.     background-image:url(images/wrapper_19.png);
  155.     width:4px;
  156.     height:inherit; /* i want it to auto or inhert*/
  157.     /*height:300px;*/
  158.     background-repeat:repeat-y;
  159. }
  160.  
  161.  
  162. .wrapper_bottom_left{
  163.     float:left;    
  164.     background-image:url(images/wrapper_22.png);
  165.     width:4px;
  166.     height:5px;
  167.  
  168.     clear:left;
  169.  
  170. }
  171.  
  172. .wrapper_bottom_center{
  173.     float:left;
  174.     background-image:url(images/wrapper_23.png);
  175.     background-repeat:repeat-x;
  176.     width:967px;
  177.     height:5px;
  178.  
  179. }
  180.  
  181. .wrapper_bottom_right{
  182.     float:left;
  183.     background-image:url(images/wrapper_25.png);
  184.     width:4px;
  185.     height:5px;
  186.  
  187.  
  188. }
  189.  
  190.  
  191. /*                 End  inner gray panel wrapper                                 */    

I want it as the class="wrapper_ middle_center" content increases the other two class like wrapper_middle_ left and wrapper_middle_ right its height should inherit from the class wrapper_middle_ center.Looking forward for yours guideline.
Attached Images
File Type: jpg wrapper.jpg (25.0 KB, 525 views)
Apr 26 '11 #1
3 9392
sidhx
50 New Member
i can do using table tag but how to do using div tag
Apr 26 '11 #2
hellodipak
26 New Member
You can do it using jquery -

Include this library: http://ajax.aspnetcdn.com/ajax/jQuer...y-1.6.1.min.js

And then the following

<script type="text/javascript">
$(document).rea dy(function(){
var contentDivHeigh t = $(".contentDiv" ).height();
$(".leftDiv, .rightDiv").css ("min-height", contentDivHeigh t);
});
</script>
May 18 '11 #3
drhowarddrfine
7,435 Recognized Expert Expert
You have no height specified. You do say to inherit, and one div says its height is 100%, but 100% of what? The body? So what is the body's height? That's not set anywhere.

@hellodipak - never use javascript to do CSS's job.
May 18 '11 #4

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

Similar topics

2
1917
by: JC | last post by:
Greetings all. I would like to know how to make a textboxs height = the height of the cell it's in minus 10 px or what ever number.. Using 90% for height does not work as I need it to be exactly so many px less than the total height and with %'s it's too dynamic from small to large screens. Thanks for any help! Jeff
6
2257
by: Robert Lapes | last post by:
I'm just getting into using CSS and I'm having a problem getting Opera to display a Navigation Bar in the same way as IE6. Can someone please point me in the right direction? The site I'm working on can be seen at http://www.budbury.co.uk/itel/index.htm In Opera 6.05 the Nav Bar image floats behind the content division that follows the navbar.
6
10921
by: veerleverbr | last post by:
Hi, I have the following html: <div id="content"> <div id="leftpart">...</div> <div id="rightpart">...</div> </div> leftpart en rightpart are in the css set to float left. The content of leftpart and rightpart div is so that both divs have different height.
0
1358
by: glenn | last post by:
I have a design question re postgres's feature of inheritance, and I need to determine if I should use this feature in this instance. I have a heirachy of tables and some associated functions that are used to cost (and store the costing) of manufacturing jobs. The resulting 'job' may then become a job that is tracked through a work flow, or included in a 'price list' or 'catalog'. Either way any given 'job' becomes a child of another...
2
2255
by: MATT | last post by:
Is there any way to get a combobox to be the same height as a textbox? The combo defaults to 21px and text defaults to 20... and I see no way to change either one to match the other. Thanks, Matt
3
1322
by: darrel | last post by:
I just noticed something in one of my applications which is in a folder within another application. My application is grabbing the DB connection string from the Web.Config file: strConnect = ConfigurationSettings.AppSettings("DBConn") My application's Web.Config file doesn't have this DBConn appSettings key, so I assume it's grabbing it from the parent applications web.config file?
12
10521
by: Jack Gavrich | last post by:
Hi, guys! I can't get IE6 to display properly menu list. In #menu i specified line-height: 1.7em; but ie6 made way bigger space. So I've specified height: 1.7em; in #menu li a. Now space is as it should be, but still it does not make space between menu border and the first item. If I am not clear enough, just compare it in Firefox, Opera etc. How to make ie6 to display like that?
5
4709
by: hzgt9b | last post by:
Background: I have a page with some divs containing text. The divs need to be a minimum height of 100px. When the text inside a div overflows the div should grow (down the page) as needed. Text should be centered... Problems 1. height vs min-height across browsers... I was able to get a partial solution using child selectors to get aroud the min-height problem in <=IE6, latest firefox, NN and Opera but not in IE7. Can someone help me...
2
3900
by: GTalbot | last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues, Imagine this situation: #grand-parent-abs-pos { height: 400px; position: absolute; width: 600px; }
0
9568
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
9399
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
10163
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...
1
9957
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
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
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
7379
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
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
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.