473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

relative element inside absolute element?

Jezternz
145 New Member
Okay so I want to place a relative division inside an absolutely positioned division.
Expand|Select|Wrap|Line Numbers
  1. <div style="position:absolute;left:50px;right:50px;top:50px;bottom:50px">
  2.     <div style="position:relative;margin:0 auto;height:100%;width:500px;">testing123</div>
  3. </div>
  4.  
This isn't the code from my website but is good enough for demonstration. So I want to absolutely position one division, then within that division I want to center another one, and have it spanning the full height of the absolutely positioned one. This code works fine in FF & Chrome, but in IE for some reason the height will only expand when content is stuck into the relative div. How can I fix this?

Cheers, J
Aug 23 '10 #1
2 1761
TheServant
1,168 Recognized Expert Top Contributor
If it works in everything except IE then your code is probably good. IE never plays by the rules which is why most developers hate it. Everything that is suggested will be a work around, and will either require you to use an IE only stylesheet, or will be using incorrect styles to get it done. I don't have my home computer to play around with this, so I can't offer a workaround right now, but maybe later.

Again, if you find a solution that fixes the IE one and doesn't break the others, use it. If it does break the others, put it in a an IE only stylesheet.
Aug 24 '10 #2
JKing
1,206 Recognized Expert Top Contributor
I'm not sure if that is the right way to be using absolute positioning. Normally you would declare a top or bottom and a left or right but not all four together.

Nonetheless, the reason IE isn't expanding to the full height is because there is no height given for the absolute div thus IE defaults to it's own height of nothing when there is no content.
Aug 25 '10 #3

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

Similar topics

1
7674
by: gqtang | last post by:
How to chage Absolute url to relative url ,and relative url to absolute url
6
787
by: ste.paoletti | last post by:
hi, I have read that browsers support block element inside inline element but the css is not valid. Someone can tell me more about? What do you think? Thanks.
1
1407
by: Luqman | last post by:
Where is Form Relative Position and Absolute Position in VS.Net 2005 ? Best Regards, Luqman
6
6483
by: axlq | last post by:
I've spent most of the day struggling with what I thought would be a trivial problem. I have a hidden element that appears, outside of the normal flow, when the mouse hovers over an inline element. HOWEVER, I want the hidden element positioned at a location of my choosing relative to that inline element. Is this possible?
5
3991
by: felipevaldez | last post by:
how can I put an element below another element, that's not absolutely positioned? so I have a n element, called X, and next to that, an element Y X Y XXXXXX
3
8974
by: mikewse | last post by:
I have a strange problem where it seems IE is doing the correct layout but Firefox and Safari isn't. I think I'm probably wrong, and there is something in the standards that say behaviour should be like Firefox does, but could someone tell me what is right? In the below code I have element trees with three DIVs; the outer DIV establishes a positioning context and the "middle" DIV uses absolute positioning to put its top left corner in the...
3
9625
by: rlueneberg | last post by:
I want to change the color of an "a" child element inside a table cell via javascript. Is there any way to do that? Ps: there is no id assigned to child elements. I would like to discover the child element and change its color from the parent element if possible. <script type="text/javascript"> function HightLightCell(mycell, mybgcolor) { mycell.bgColor=mybgcolor; }
5
2964
by: SuneR | last post by:
Hi, I am having problems figuring out how to make Firefox behave, and output the HTML I want it to output. The thing I want done is actually quite simple. I have a <labeltag, and inside it, I have a script tag, that document.write's some HTML. Like this:
2
5469
by: MATTXtwo | last post by:
how to get/set element that inside of iframe from parent pages.. please give me tip.. my iframe define :name="ifrMenu" id="ifrMenu" the element inside of iframe that i need control :id="mnuLevel"
2
19315
by: AlannY | last post by:
Hi there. I'm writing a program under Linux. I need a function that convert relative path to absolute (or full path). Under Windows, I have a GetFullPathName function in WinAPI. But now, I need function for Linux (glibc may be). Can someone help me? P.S. Googling, googling... nothing found ;-(
0
8683
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
9170
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
9031
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
8901
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
8871
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.