473,406 Members | 2,867 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,406 software developers and data experts.

IE positioning bug and its solution.

I just found a bug that's related to positioning in IE 5.5 (could someone
please tell me if this bug exists in IE 6, and if so, if my solution works in
that browser?). I don't know if this bug has been reported before, but here
it is, and its solution, in case anyone else runs into it.

On the following page there is a box (DIV) that contains six anchors. The
anchors have a style of display:block, so you should be able to move the mouse
cursor ANYWHERE inside the box to click on a link. However, that is not the
case in IE 5.5. In IE 5.5, you can only click on a link when the mouse cursor
is on top of the anchor's text. If the mouse cursor moves to the side of the
text, the link can no longer be clicked. This bug does not appear in Mozilla
or Opera. Here is a page that shows the problem:

http://home.comcast.net/~delerious1/index10a.html

Could someone with IE 6 and Javascript enabled please tell me if the bug
occurs in that browser?

I know that the bug is related to positioning, because the following
javascript code is executed when the page is loaded:

divElement.style.left = '100px';
divElement.style.top = '100px';

If I take those two lines out, then the bug does not occur.

The solution to this bug is to call the focus() and blur() methods on one of
the anchors when the page is loaded. Here is a page that shows the solution:

http://home.comcast.net/~delerious1/index10b.html

If the bug exists in IE 6, could someone please tell me if this solution fixes
it in that browser?

Thanks.

Jul 20 '05 #1
7 2194
On Fri, 19 Dec 2003 04:41:46 GMT, de*******@no.spam.com declared in
comp.infosystems.www.authoring.stylesheets,alt.html:

On the following page there is a box (DIV) that contains six anchors. The
anchors have a style of display:block, so you should be able to move the mouse
cursor ANYWHERE inside the box to click on a link.
However, that is not the case in IE 5.5.
No surprises there. ;-)
In IE 5.5, you can only click on a link when the mouse cursor
is on top of the anchor's text. If the mouse cursor moves to the side of the
text, the link can no longer be clicked. This bug does not appear in Mozilla
or Opera.
No surprises there either. :-D
Here is a page that shows the problem:

http://home.comcast.net/~delerious1/index10a.html

Here is a page that shows the solution:

http://home.comcast.net/~delerious1/index10b.html

If the bug exists in IE 6,
Yes.
could someone please tell me if this solution fixes
it in that browser?


Yes. If Javascript is enabled, of course.

Yes, it's a known bug. It is nothing to do with Javascript, of course. It
is the fact that the div is positioned. I can't remember the solution
offhand (other than not positioning it, of course).

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #2

"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:1p****************************@40tude.net...
On Fri, 19 Dec 2003 04:41:46 GMT, de*******@no.spam.com declared in
comp.infosystems.www.authoring.stylesheets,alt.html:

On the following page there is a box (DIV) that contains six anchors. The anchors have a style of display:block, so you should be able to move the mouse cursor ANYWHERE inside the box to click on a link.


The hand only activates when the cursor is over the text.
Which is what the anchor is referring to, not the division itself.
Perhaps padding with trailing spaces might cure that problem.
IE6 BTW.

Jul 20 '05 #3
de*******@no.spam.com wrote:
[snip]
On the following page there is a box (DIV) that contains six anchors.
The anchors have a style of display:block, so you should be able to
move the mouse cursor ANYWHERE inside the box to click on a link.
However, that is not the case in IE 5.5. In IE 5.5, you can only
click on a link when the mouse cursor is on top of the anchor's text.
If the mouse cursor moves to the side of the text, the link can no
longer be clicked. This bug does not appear in Mozilla or Opera.
Here is a page that shows the problem: [snip] If the bug exists in IE 6, could someone please tell me if this
solution fixes it in that browser?


I have just copied your code and added a "width: 400px;" after the "display:
block;". This makes it fairly consistent in IE 5, IE 6, and others.

In fact, I have been using the combination of display: block and width on all
my web sites for some time to make my buttons look OK. Normally I use a
percentage - someone said that you shouldn't use 100% because of an IE bug, so
I use 99.9%, but I don't know if that is true. Have a look at them, below. You
may need to experiment. My sites don't use Javascript.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #4
Richard wrote:
The hand only activates when the cursor is over the text.
Which is what the anchor is referring to, not the division itself.
Perhaps padding with trailing spaces might cure that problem.
IE6 BTW.


If it's display:block, that's incorrect.

Jul 20 '05 #5
Barry Pearson wrote:
In fact, I have been using the combination of display: block and width on all
my web sites for some time to make my buttons look OK. Normally I use a
percentage - someone said that you shouldn't use 100% because of an IE bug, so
I use 99.9%, but I don't know if that is true. Have a look at them, below. You
may need to experiment. My sites don't use Javascript.


Older versions of IE think that 100% means 100% of the page, rather than
100% of the containing element.

Jul 20 '05 #6
<de*******@no.spam.com> wrote in message
news:3f***************@news.md.comcast.giganews.co m...
I just found a bug that's related to positioning in IE 5.5 (could someone
please tell me if this bug exists in IE 6, and if so, if my solution works in that browser?). I don't know if this bug has been reported before, but here it is, and its solution, in case anyone else runs into it.

On the following page there is a box (DIV) that contains six anchors. The
anchors have a style of display:block, so you should be able to move the mouse cursor ANYWHERE inside the box to click on a link. However, that is not the case in IE 5.5. In IE 5.5, you can only click on a link when the mouse cursor is on top of the anchor's text. If the mouse cursor moves to the side of the text, the link can no longer be clicked. This bug does not appear in Mozilla or Opera. Here is a page that shows the problem:

http://home.comcast.net/~delerious1/index10a.html

Could someone with IE 6 and Javascript enabled please tell me if the bug
occurs in that browser?

I know that the bug is related to positioning, because the following
javascript code is executed when the page is loaded:

divElement.style.left = '100px';
divElement.style.top = '100px';

If I take those two lines out, then the bug does not occur.

The solution to this bug is to call the focus() and blur() methods on one of the anchors when the page is loaded. Here is a page that shows the solution:
http://home.comcast.net/~delerious1/index10b.html

If the bug exists in IE 6, could someone please tell me if this solution fixes it in that browser?

Thanks.


I believe the error occurs because a soon as you dynamically (style/css)
position an element it is removed from the normal 'flow' of the document and
placed on it's own layer. This somehow affects how the block element is
rendered by the browser.

Your example - somewhat simplified:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<HTML>

<HEAD>
<META http-equiv="Content-Script-Type" content="text/javascript">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>test</TITLE>
<STYLE type="text/css">
A {
background-color: blue;
color: white;
display: block;
font-family: Verdana;
font-size: x-small;
font-weight: normal;
padding-left: 0.3em;
padding-right: 0.4em;
text-decoration: none;
width: 100%;
}

A:hover {
background-color: rgb(0,192,255);
}

#submenu {
border-color: rgb(0,192,255);
border-style: solid;
border-width: 2px;
left: 200px;
position: absolute;
top: 100px;
visibility: visible;
width: 200px;
}

</STYLE>
</HEAD>
<BODY>
<DIV id="submenu">
<A id="a1" href="fakepage.html">link 1</a>
<A id="a2" href="fakepage.html">Link number 2.00</a>
<A id="a3" href="fakepage.html">Link trey</a>
<A id="a4" href="fakepage.html">Link fourvages</a>
<A id="a5" href="fakepage.html">Link 5</a>
<A id="a6" href="fakepage.html">Link #6</a>
</DIV>
</BODY>
</HTML>

Without Javascript you need to add the WIDTH attribute for your DIV
submenu. Use whatever form you want (px or % probably).
Jul 20 '05 #7
Oh no, I just discovered my solution doesn't work in IE 5.0. :(

Jul 20 '05 #8

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

Similar topics

13
by: murali | last post by:
Hello everyone, I used absolute positioning with div tag in my website. The page looks cool as long as someone doesn't try to zoom in by increasing the text size (ctrl++ or thru changing font...
9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
36
by: Jack Hughes | last post by:
This argument has come up two or three times lately. We have a web standards document at our company that say "Use valid HTML 4; We don't recommend switching to DIV-based CSS-P for layout just...
4
by: Jane Withnolastname | last post by:
I am trying to re-work an old site by replacing the html with css. On the main page, I have a logo image which I needed centred on the initial screen. I found the solution here:...
8
by: Asad | last post by:
Hi, I am basically trying to accomplish drop down menus for navigation on a site. And I'm pretty much done except I am having one problem. The z-index is not working with relative positioning! ...
11
by: NS | last post by:
I am relativly new to css positioning and have a question regarding the display of a DHTML pop-up Here is the basic HTML I am using: <html> <head> <script language="JavaScript"> <!--
4
by: TheCeej | last post by:
I'm sorry to post what is ultimately a myspace problem, but I'm sure I'd still be having this problem with any html/css document, so the answer would more than likely be able to help anyone out. I'm...
6
by: K. | last post by:
Hello all! I have a question. I have built a page. I would like to make my page better positioning in the web searchers i.e. in google search browser. There are many companies which do such...
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
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...
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
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...
0
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,...
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...
0
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,...
0
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...

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.