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

IE: Indentation breaks relative link

In the following html page, I'm using a stylesheet to move
everything in the body over five percent, and then move the
h1 heading back over to the left margin. On IE 6 (W2K & 98)
the relative link (fragment identifier) only works if the
heading text is wider than five percent of the window size.
(In other words, change the lowercase letter "l" used below
into something longer -- or make the window sufficiently
narrow -- and it'll start working.)

Is this a known bug? Is there a workaround? (I'm just
trying to do basic indentation -- to have the headings at
the left margin, and have other stuff indented. My current
workaround is just to settle for an indentation narrow
enough that all my headings are wider than that
indentation.)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=us-ascii" />
<title>Test</title>
<style type="text/css">
<!--
body {
margin-left: 5%;
}
h1{ margin-left: -5%; }
-->
</style>
</head>
<body>
<p>
<a href="#linky">Click me</a>
<!-- These breaks are just to put some vertical whitespace
in the page. -->
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</p>
<h1><a id="linky">l</a></h1>
</body>
</html>

Thanks,

--
Aaron Brown
arundelo @ hotmail.com
Jul 20 '05 #1
2 2456
Els
Aarono Brown wrote:
In the following html page, I'm using a stylesheet to move
everything in the body over five percent, and then move the
h1 heading back over to the left margin. On IE 6 (W2K & 98)
the relative link (fragment identifier) only works if the
heading text is wider than five percent of the window size. Is this a known bug? Is there a workaround?
It works correctly in Firefox, but not in IE6 on WinXP.
I think it has to do with the negative margin. Not entirely
sure though.

Workaround could be this:

<style type="text/css">
body {
margin-left:0;
text-indent:5%;
}
h1{
text-indent: 0%;
}
</style>

But: <h1><a id="linky">l</a></h1>


Why don't you just write
<h1 id="linky">l</h1>
?

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Kirsty MacColl - A New England
Jul 20 '05 #2
Els wrote:
It works correctly in Firefox, but not in IE6 on WinXP.
Yeah, I didn't mention it in the original post, but I tried
it successfully on Firefox as well.
Why don't you just write
<h1 id="linky">l</h1>
?
Good question -- I'm automatically generating the html where
I originally encountered the problem, and it uses the same
function to generate hyperlinks wherever they are. When I
edited it down to the sample code that I posted, it never
occured to me to get rid of the anchor tag.
Workaround could be this:

<style type="text/css">
body {
margin-left:0;
text-indent:5%;
}
h1{
text-indent: 0%;
}
</style>


This works, but when I apply it to the real page, I can't
get the tables (real tabular data) to indent correctly
(neither in IE nor in Firefox). (Also, the fact that,
unlike margins, indentation applies only to the first line
of a block isn't appropriate for what I'm doing.)

However, you put me on the right track. Instead of using
margin-left to skooch the whole body to the right and then
using it again on the headings I wanted on the left, I tried
just using margin-left just on the list of all tags that I
want skooched (and letting everything else default to the
left side):

p,h3,table { margin-left: 5%; }

The page is now, as far as I can tell, working perfectly in
both IE and Firefox.

Thanks a lot for the help,

--
Aaron Brown
arundelo @ hotmail.com
Jul 20 '05 #3

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

Similar topics

24
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html...
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! ...
10
by: Neil Zanella | last post by:
Hello, I would like to achieve the following effect for an FAQ page without having to resort to html tables. What is the best way to do it using CSS (note how the indentation is table-like)? ...
2
by: Martin Geisler | last post by:
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDNmLx6nfwy35F3TgRAtjIAJ9ryEjr0kaaEapRD0z1bHQYmKi+1wCdEOZC /wY2033SyIVl0za07v8RMkk= =6BZ+ -----END PGP SIGNATURE-----
3
by: TS | last post by:
HI, is there any option while using appendChild so that it doesn't do the autotomatic indentation and line breaks so that the tags are appended back to back? thanks
44
by: Joe | last post by:
Is Python going to support s syntax the does not use it's infamous whitespace rules? I recall reading that Python might include such a feature. Or, maybe just a brace-to-indentation preprocessor...
13
by: Casimir Pohjanraito | last post by:
I have a list of links, with a thumbnail image hidden(resized) next to the link. Complete html&css at end of this post. CSS for the link resizes the image on a:hover. All is good, except the...
5
shishisu
by: shishisu | last post by:
I figure this might be a fun challenge to some of you out there... I appreciate all the help. Thanks in advance. Here we go... I have 2 web page (on different servers) I am working on. Here,...
13
by: ...:::JA:::... | last post by:
Hello, In my previously post I have been talk about running code with exec in...... So now I have problem with code indentation, as Gabriel Genellina says: So......how can I do...
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
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,...
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
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.