SitePoint Sponsor |
|
User Tag List
Results 1 to 16 of 16
Thread: Anchor problems! Help please..
-
Jun 10, 2006, 17:14 #1
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Anchor problems! Help please..
Hi...
I'm having a problem with my anchors not going to the right place. I have my anchors positioned at the begining of a section in my document. But rather than the content from the top of the section being displayed it shows a bit of the section above as well.
I'm quite new to all this so hope I'm making sense and that its not simply a problem with my coding.
I hope someone can help me out with this.
Thanks for your time.
Ayesha
http://ayesha.webeyedea.info/naqsha
-
Jun 10, 2006, 18:16 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
tags
Hi naqsha, welcome to the forums,
Years back, the only thing that could have target anchors were anchor tags. Now anything can be targetted. So, in your code eg.
HTML Code:<a name="graphic"></a> <!--nav menu for ie--> <div id="nav2"> <ul> <li> <a href="#portfolio" target="_self"> Portfolio </a> </li> <li> <a href="#about" target="_self"> About </a> </li> <li> <a href="#top" target="_self"> <img src="images/home.gif" alt="home" title="home" height="18" width="18" /> </a> </li> <li> <a href="#contact" target="_self"> Contact </a> </li> <li> <a href="#links" target="_self"> Links </a> </li> </div> <img src="images/graphic.gif" alt="graphic design portfolio" title="graphic design portfolio" height="121" width="600" /> <div id="graphic">
HTML Code:<a name="graphic"></a>
HTML Code:<div id="graphic">
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Jun 11, 2006, 04:12 #3
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi Mitteneague...
Thanks a lot for the reply...
I just tried making the tag names different to those of the divs but I'm still having the problem I had before.
I have a back to top button in a div just before the anchor tag, with the section content following the anchor. When I click the link to the anchor it shows me the page from the back to top div and not from the anchor downwards. As in, the back to top button is right on top of the screen when what I want is the header image to be at the top.
One of the reasons I wanted to fix this is because I have a fixed nav bar (for browsers other thn IE) and I didnt want the back to top button stuck up there!
Any suggestions for this would be much appreaciated.
Thanks
Ayesha.
-
Jun 11, 2006, 04:38 #4
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
try puttin the anchor/id="name" within the <h1> tag. see how that goes.
-
Jun 11, 2006, 05:29 #5
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks for ur suggestion belledumonde
<h1> <a name="contact"></a> </h1>
is that what u meant...(sorry if i seem ignorant)
coz i tried that and it doesnt work...Last edited by naqsha; Jun 11, 2006 at 06:38.
-
Jun 11, 2006, 07:03 #6
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you can also ad the id to the h1 tag <h1 id="whatever"></h1> (i think....
)
hm... maybe its got to do with the browser? coz sometimes when i use anchors, in firefox, there really is some space above it, and in IE, there isnt any.
what about placing the anchor lower in the design? like in the text or something? then the extra space will show the title instead of whats above the title??
-
Jun 11, 2006, 08:02 #7
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for your help belledumonde...
I'll try moving the anchor around to get it to work right.
I thought there might be something wrong with my coding which was making it act funny!
-
Jun 11, 2006, 18:15 #8
- Join Date
- Dec 2005
- Location
- New Zealand
- Posts
- 488
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi naqsha.
Can't get your page to open?
-
Jun 11, 2006, 18:41 #9
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hey naqsha! been looking at some of your other sites, id just like to say, i really like your designs. everything is clean and easy. how do you do it? hehe!
-
Jun 12, 2006, 01:10 #10
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi fisherboy...The prob was that the link to the anchor isnt skipping to where I want it to on the page but showing extra content on top. The link to the first section is fine but the other links show the back to top button of the previous section as well. *sigh*
Glad you liked my sites belledumonde.... I'm just starting out with web design. Hopefully other people will like them enough to give me some work.
-
Jun 12, 2006, 03:10 #11
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you might just be starting out with web development and design, but your design skills translate really well on screen.
have you been able to fix the anchor problem yet? tried moving the anchor a little further down the page?
-
Jun 12, 2006, 08:24 #12
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
ids
The problem may have something to do with using id instead of class.
Id is for a uniquely named element. Class can be used for more than one.
You have more than one <div id="back_top">, <div id="nav2">, and<div id="thn">.Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Jun 12, 2006, 16:30 #13
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Belledumonde - I did try moving the anchor around. I originally had it above the section header. When I put it below the header, it decides to work right and shows me content just below the anchor point!!
Mitteneaque - I havent tried making the divs used more than once into classes yet. Will give that a try. Thanks for the suggestion.
-
Jun 12, 2006, 23:36 #14
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hello again! i just noticed something, it doesnt work in IE. i mean, not the way i think you want it to work -- which is the way it works in FF. the menu isnt fixed at the top. but then you might have changed this aspect, in which case just ignore this message.
-
Jun 13, 2006, 03:16 #15
- Join Date
- Jun 2006
- Location
- London, U.K.
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hehehe.... position: fixed; doesnt work in IE thats why I have the menu repeating at the top of every section and I've hidden it in all other 'good' browsers.
-
Jun 13, 2006, 03:52 #16
- Join Date
- May 2006
- Posts
- 143
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
reeeeeeeally? had no idea! IE sucks, had no idea how much till the person who reprogrammed by computer included FF.
Bookmarks