473,394 Members | 1,829 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,394 software developers and data experts.

Opera relative and absolute positioning

Hi all,
I've met a problem with Opera and its ability to render absolutely
positioned divs inside relatively positioned parent blocks, themselves
contained inside a relatively positioned block.
I'm surely missing something, but what? Any help would be kindly
appreciated :)

Here's a code sample:

..grandparent{position:relative;}
..parent{position:relative;}
..parent .sub{
position:absolute;
top:19px;
left:0px;
display:none;
z-index:1;
}

<div class="grandparent">
<div class="parent">
<div class="sub">text</div>
</div>
</div>

The display:none property is modified to display:block on a click
event happening somewhere else. Hence the hidden div appears as a
submenu, whose position depends on the parent block.

Any clue on why Opera cannot position this child block correctly? Or
is there anything wrong with my way of doing it? In fact, the .sub
divs seem to be positioned relative to the .grandparent div, not their
respective .parent divs.

Thanks for the anwser
Jul 20 '05 #1
4 8718
Els
louissan wrote:
.grandparent{position:relative;}
.parent{position:relative;}
.parent .sub{
position:absolute;
top:19px;
left:0px;
display:none;
z-index:1;
}

<div class="grandparent">
<div class="parent">
<div class="sub">text</div>
</div>
</div>

Any clue on why Opera cannot position this child block correctly? Or
is there anything wrong with my way of doing it? In fact, the .sub
divs seem to be positioned relative to the .grandparent div, not their
respective .parent divs.


As to _why_ I don't really know, but I used to have the same
problem. I decided to take away the position:relative of the
..parent, and have the .sub positioned absolute, relative to
the .grandparent, in all browsers.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #2
In article louissan wrote:
Hi all,
I've met a problem with Opera and its ability to render absolutely
positioned divs inside relatively positioned parent blocks, themselves
contained inside a relatively positioned block.
I'm surely missing something, but what? Any help would be kindly
appreciated :)

Here's a code sample:
URL would be better, as your code does nothing useful to demonstrate your
problem.
The display:none property is modified to display:block on a click
event happening somewhere else. Hence the hidden div appears as a
submenu, whose position depends on the parent block.
OK. So I changed it, and still unable to see any difference.
Any clue on why Opera cannot position this child block correctly?
What version of Opera? I don't know if any version of opera since 4 is
buggy in this.
Or is there anything wrong with my way of doing it? In fact, the .sub
divs seem to be positioned relative to the .grandparent div, not their
respective .parent divs.


With your code, there is no difference, as grandparent and parent are
identical. If I ad something before parent, it is apparent that
positioning works correctly.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
I'm looking for work | Etsin työtä
Jul 20 '05 #3
lo******@caramail.com (louissan) wrote:
I've met a problem with Opera and its ability to render absolutely
positioned divs inside relatively positioned parent blocks, themselves
contained inside a relatively positioned block.

.grandparent{position:relative;}
.parent{position:relative;}
.parent .sub{
position:absolute;
top:19px;
left:0px;
display:none;
z-index:1;
}

<div class="grandparent">
<div class="parent">
<div class="sub">text</div>
</div>
</div>

The display:none property is modified to display:block on a click
event happening somewhere else. Hence the hidden div appears as a
submenu, whose position depends on the parent block.
Then there wasn't much point in including it in the example was there?
Any clue on why Opera cannot position this child block correctly? Or
is there anything wrong with my way of doing it? In fact, the .sub
divs seem to be positioned relative to the .grandparent div, not their
respective .parent divs.


The above example renders the same in Opera 7.23 and IE6, in both
Quirks and Standards modes.

Do you by any chance have a float on .parent? That will make a
difference. Opera doesn't allow an element to be both positioned and
floated and will apply the float but ignore the position.

This is probably an error - the CSS specs say that float does not
apply to absolutely positioned elements, but doesn't, as far as I can
see, say anything about the interaction of float and relative
position.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #4
Thanks :)

It just so happens that i had a float on .parent ... but indirectly.

I had a .grandparent *{float:left} declared somwhere up in the stylesheet.

Thank you again, Steve.

Steve Pugh <st***@pugh.net> wrote in message news:<9b********************************@4ax.com>. ..
Do you by any chance have a float on .parent? That will make a
difference. Opera doesn't allow an element to be both positioned and
floated and will apply the float but ignore the position.

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These...
4
by: Marek Mänd | last post by:
xHTML 1.0 strict and valid css. But though only IE shows up like I like it. Not Opera7.50PR1, not Mozilla1.6. Mozilla and Opera doesnt take interest in absolute positioning herein this...
4
by: Els | last post by:
Hi all, Whilst testing other things on www.browsercam.com, I found that some pages with absolute positioned pictures were all messed up in Mac's Opera 6.0 and even worse on Safari 1.0, and...
1
by: JKenyon | last post by:
I am attempting to display two images on a web page. The second "image" is actually two images, one overlaid on the other. The first one is aligned on the left using float:left. I have enclosed...
24
by: Wim Roffal | last post by:
I am trying to create a menu system. The mainmenu is a table <table><tr><td>menu1</td><td>menu2</td></tr></table> No I try insert the submenu so that it becomes relative to the main menu...
1
by: Fred Nelson | last post by:
Hi: I'm working on one of my first web applications in asp.net 2.0 and I'm having a problem with absolute versus relative positioning of controls that I place on pages that use master pages with...
2
by: nonsensitor | last post by:
I'm just learning xhtml & css, primarily from westciv's online tutorials and css guide. I've run into a couple of problems with a page I'm developing that I can't figure out. The first problem is...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
6
by: Mark | last post by:
hi, i'm trying to position something in the top right corner of a container, but i can't seem to figure out how to get it working. here's the html <div class='thumb'><a href='image.jpg'><img...
14
by: Fistro | last post by:
I'm trying to find a design that would allow me to build web pages without having to worry about compatibility issues (not too much, in any case,,,) I've came across this CSS layout technique:...
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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...
0
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...

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.