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

Float and position: relative makes link unclickable

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDNmLx6nfwy35F3TgRAtjIAJ9ryEjr0kaaEapRD0z1bH QYmKi+1wCdEOZC
/wY2033SyIVl0za07v8RMkk=
=6BZ+
-----END PGP SIGNATURE-----
Sep 25 '05 #1
2 3851


Martin Geisler wrote:

I'm unsure if this is the intended behavaiour or a bug in Firefox, but
if I do

<div style="float: right"><a href="#">A link</a></div>
<h1 style="position: relative">A title</h1>

I cannot click on the link --- it is covered by the title. Without
the `position: relative' it works as expected.

I thought that with `position: relative' the h1 element would be laid
out as usual and then shifted as specified by top, left, etc. Firefox
seems to do something more: change the stacking order.


A small part of the link is clickable in Opera or Firefox, if you add

<div style="float: right"><a href="http://example.com/">example
link</a></div>

<h1 style="position: relative; border: 1px solid green;">A title</h1>

and then move your mouse on top of the link but a pixel or so above the
border of the h1 element then you can get at that part of the link that
is clickable. But most of the link indeed sits below the h1 and just
shines through its transparent background. As for the stacking, yes,
floated elements and positioned elements sit on a different stacking
level, see <http://www.w3.org/TR/CSS21/visuren.html#q29> which says:

Each stacking context consists of the following stacking levels (from
back to front):

1. the background and borders of the element forming the stacking
context.
2. the stacking contexts of descendants with negative stack levels.
3. a stacking level containing in-flow non-inline-level descendants.
4. a stacking level for floats and their contents.
5. a stacking level for in-flow inline-level descendants.
6. a stacking level for positioned descendants with 'z-index: auto',
and any descendant stacking contexts with 'z-index: 0'.
7. the stacking contexts of descendants with positive stack levels.

So due to the position: relative the h1 sits on top most of that floated
div with the link.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 25 '05 #2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDOFTe6nfwy35F3TgRAhZkAJ9AXvrtcfqyklrdJDPrya oKtjKa4QCgixEz
q3f1dKuferzyVS/6AeKLz/I=
=rVrU
-----END PGP SIGNATURE-----
Sep 26 '05 #3

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

Similar topics

3
by: Günther Stößl | last post by:
Hello I am trying to position two floats inside a table column. <td> <div style="position:relative; width:100%"> <div style="position:absolute; left:0px; width:60%>... </div> <div...
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...
1
by: Pau Roldan | last post by:
Hi, sorry if this has been asked previously, but I couldn't find a suitable answer in previous posts. Here is a sample page illustrating the problem:...
0
by: jonipony | last post by:
HELP: Float Left box is drifting to the right in ie! -------------------------- I need som HELP with my CSS coding! On the following web page my design falls apart at screen size 800 x 600...
10
by: Mark | last post by:
According to my book on CSS, if you apply 'position: relative' to a block-level element, it will stay exactly where it is. However, you can then use top, left etc. to offset the element relative to...
27
by: GloStix | last post by:
WARNING VIDEO TAKES A WHILE TO LOAD http://screencast.com/t/BWQ6DNtsM I really don't know how to fix this other than putting another div. But I dont' exactly want to do that for every page....
0
by: Ben C | last post by:
On 2008-04-04, dorayme <doraymeRidThis@optusnet.com.auwrote: Technically it is still "in the flow" (this is the way the spec talks about it). But stacked differently, and offset if you offset...
5
by: Peter May | last post by:
Hi. On the http://skroc.pl/69d8 are images in the body (# singlepage), which are given to float. The problem is that after mouse is over on them if they flee the mouse (browser IE6 and 7). I...
15
dlite922
by: dlite922 | last post by:
I'm back again, Intro: I've got a floating div (outerDIV) with fixed width that contains an image (IMG) and a div that contains a short text (innerDIV) Problem: In FF, the innerDIV is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.