473,738 Members | 3,636 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 1768
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
7677
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
1408
by: Luqman | last post by:
Where is Form Relative Position and Absolute Position in VS.Net 2005 ? Best Regards, Luqman
6
6484
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
3993
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
8980
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
2967
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
5471
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
19323
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
8969
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
8788
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
9476
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
9335
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...
0
9208
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
6053
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();...
0
4570
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...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
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.