|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
Anchor tags not going to the right spot....
09-24-2010, 09:58 AM
|
Anchor tags not going to the right spot....
|
Posts: 4
Name: Candace
Location: Ontario, Canada
|
So, this is normally the most simple part of my job... add anchors at the bottom so that the user can go to a certain section of the site... well for some reason, I just can't get them to work... the site is:
www.locatorindustries.com/rivets.html
the anchor links are at the bottom - Home is a link to another page, The "Top of Page" anchor works, the "About Us" link makes the page move up, but not to the right spot, and the "About You" doesn't work at all (Don't worry about the "About Rivets" its silly it's there in the first place but it was a request from the company. I have floating divs, so I've tried the <a name="" id=""> in the image div, on the <p> tag for the title of each section in a blank div above each section, to no avail. Can anyone give me some insight into why the tags just won't work?
Let me know if you need any more info and I'll gladly give.
Cheers,
Candace
|
|
|
|
09-24-2010, 10:52 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
Can I ask why exactly you want the page to behave like this? I would say it's pretty pointless in usability terms.
On my screen, for example, pretty much the entire page shows up so there's little need for this at all.
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
|
|
|
|
09-24-2010, 10:58 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4
Name: Candace
Location: Ontario, Canada
|
I absolutely agree with you, it's an argument I lost with the client. I need to have it working.
|
|
|
|
09-24-2010, 11:08 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
Ok let me take a look at the code.
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
|
|
|
|
09-24-2010, 11:16 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4
Name: Candace
Location: Ontario, Canada
|
Thanks for any help you can give!!
|
|
|
|
09-24-2010, 11:55 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
As far as I can see the code is fine. I downloaded the HTML and opened it locally in Safari, and the anchors work perfectly when there's no graphics on the page.
I think the issue is that the anchors are contained within floating divs, which aren't part of the page flow. Try moving them to outside those floating divs. Should work fine then. Of course you'll always have a problem with the "About Rivets" section as it wouldn't be possible to take that to the top of the page on larger screens as there isn't enough below it.
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
|
|
|
|
09-24-2010, 11:56 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4
Name: Candace
Location: Ontario, Canada
|
Ok - Thanks! I'll give that a try!
Cheers!
Candace
|
|
|
|
09-24-2010, 12:15 PM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
Let me know how it goes.
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
|
|
|
|
09-24-2010, 08:00 PM
|
Re: Anchor tags not going to the right spot....
|
Posts: 10,017
Location: Tennessee
|
The float has NOTHING to do with whether or not an anchor tag works!
For one thing, you should be using proper Heading tags, H1, H2, H3, etc., not styling paragraph text to LOOK like a heading. You can then easily define an anchor for "About Us" like this:
<h2 id="aboutus">About Us</h2>
Style the text in the CSS, which really should not be in-line either.
You reference the anchor the same way - <a href="#aboutus">link</a>
You have no anchor in your code at all for "about us", so the link has nowhere to go.
This also eliminates the need for extraneous <a> tags just to create an anchor.
Noticed in your css, on your main div, you have a float: left; and position:absolute both - they can't and won't work together, it's one or the other.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
Last edited by LadynRed; 09-25-2010 at 04:17 PM..
|
|
|
|
09-25-2010, 07:47 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
Quote:
Originally Posted by LadynRed
The float has NOTHING to do with whether or no an anchor tag works!
|
Well I didn't think so either. Yet, after downloading the page, and taking them outside of the floats, they work. Fancy that.
Quote:
Originally Posted by LadynRed
For one thing, you should be using proper Heading tags, H1, H2, H3, etc., not styling paragraph text to LOOK like a heading. You can then easily define an anchor for "About Us" like this:
<h2 id="aboutus">About Us</h2>
Style the text in the CSS, which really should not be in-line either.
You reference the anchor the same way - <a href="#aboutus">link</a>
You have no anchor in your code at all for "about us", so the link has nowhere to go.
|
"about us" clearly points to "about2".
I would certainly recommend using appropriate heading tags, for SEO benefits if nothing else.
For a simple, small site such as this, there's nothing wrong with the odd bit of inline styling...
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
Last edited by edgray; 09-25-2010 at 07:52 AM..
|
|
|
|
09-25-2010, 04:20 PM
|
Re: Anchor tags not going to the right spot....
|
Posts: 10,017
Location: Tennessee
|
It's not an 'odd bit' of inline styles, it's EVERYWHERE. It's inefficient and weighs down the page unnecessarily. It defeats one of the benefits of using css and that is the ability to change things site-wide by touching ONE file - the css file. With in-line styles like that you still have to touch every single page where any changes would need to occur.
The float has nothing to do with the anchors. It is likely more to do with the absolute and static positioning.. which is also largely unnecessary.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
09-27-2010, 05:04 AM
|
Re: Anchor tags not going to the right spot....
|
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
|
Quote:
Originally Posted by LadynRed
It's not an 'odd bit' of inline styles, it's EVERYWHERE. It's inefficient and weighs down the page unnecessarily. It defeats one of the benefits of using css and that is the ability to change things site-wide by touching ONE file - the css file. With in-line styles like that you still have to touch every single page where any changes would need to occur.
The float has nothing to do with the anchors. It is likely more to do with the absolute and static positioning.. which is also largely unnecessary.
|
I totally agree with you in normal circumstances, however, I'm assuming the chap working on this site isn't intending on doing any style changes for this client, it sounds like what they were after was pretty specific and also that they're a difficult client. I'd have probably done the same in these circumstances.
__________________
Please login or register to view this content. Registration is FREE - a project in video and sound.
Please login or register to view this content. Registration is FREE "Absolute Rubbish, an insult to the blues." - NME.
Please login or register to view this content. Registration is FREE - Come use our agency :)
|
|
|
|
|
« Reply to Anchor tags not going to the right spot....
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|