Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 9, 2012, 11:11 PM   #1
John444
macrumors member
 
Join Date: Feb 2011
Intra-page linking

Hey everyone, here is the catch. I want my link to, when clicked, link to a place further down on the page. However I have a fixed header that stays in its spot despite the scrolling of the page, so I want the title I am linking to to appear say about 150px from the top. Is there a way to intra-page link to a place further down the page so that it loads the title 150px from the top?

I know normally an intra page link is <a href="#here">click here</a>
<a name="here" id="here">It loads here</a>

However 'It loads here' would appear at the very top of the screen (thus covered by the fixed banner), were as I want it to load 150px down.

Can anyone help me solve this problem?
John444 is offline   0 Reply With Quote
Old Jun 10, 2012, 02:36 AM   #2
Albright
macrumors member
 
Join Date: Aug 2011
The correct answer is to not use floating headers like that. It is a horrible practice. Aside from what you describe, such things also break paging through your site with the Page Up/Page Down keys or space bar, totally frustrating users who like to read this way (like me). Do you really want to frustrate your readers like this?

If you must - you absolutely must - have your logo or whatever visible on screen at all times or whatever, put it in a sidebar and have that float, or just some other place where it won't appear over your page's content.
Albright is offline   -2 Reply With Quote
Old Jun 10, 2012, 08:19 AM   #3
John444
Thread Starter
macrumors member
 
Join Date: Feb 2011
I must have the header, it is a requirement. Should I use frames then?
John444 is offline   0 Reply With Quote
Old Jun 10, 2012, 09:05 AM   #4
NathanCH
macrumors 65816
 
NathanCH's Avatar
 
Join Date: Oct 2007
Location: Stockholm, Sweden
Send a message via Skype™ to NathanCH
Actually, Albright, that's not the correct answer. I do agree that it is annoying, but a lot clients do want these sorts of things nowadays and its good to know how to do it. Cmon, even Google uses it.

Thankfully it's not hard to do, and you definitely do not want to use iFrames

Code:
.moveDown{
position: relative;
top: -150px;
}
Code:
.linkPosition{
position: absolute;
}
For your link just do this:

Code:
<div class="moveDown"><a name="aboutme" class="linkPosition"></div>
__________________
Design/Development Portfolio: Cetan.ca
NathanCH is offline   0 Reply With Quote
Old Jun 10, 2012, 11:48 PM   #5
John444
Thread Starter
macrumors member
 
Join Date: Feb 2011
Quote:
Originally Posted by NathanCH View Post
Actually, Albright, that's not the correct answer. I do agree that it is annoying, but a lot clients do want these sorts of things nowadays and its good to know how to do it. Cmon, even Google uses it.

Thankfully it's not hard to do, and you definitely do not want to use iFrames

Code:
.moveDown{
position: relative;
top: -150px;
}
Code:
.linkPosition{
position: absolute;
}
For your link just do this:

Code:
<div class="moveDown"><a name="aboutme" class="linkPosition"></div>
I can't seem to get it to work, Is there any way you could post an exemplar? (just a very very basic one),
thanks for the responses
John444 is offline   0 Reply With Quote
Old Jun 11, 2012, 06:30 AM   #6
NathanCH
macrumors 65816
 
NathanCH's Avatar
 
Join Date: Oct 2007
Location: Stockholm, Sweden
Send a message via Skype™ to NathanCH
Hey, sorry I made a mistake in that code yesterday. I left out the closing tags for the link. Here is a live example:

http://www.cetan.ca/workshop/fixedheader.html

Take a look at the source (and inline css at the top). Let me know if this works for you and if anyone finds a better way
__________________
Design/Development Portfolio: Cetan.ca
NathanCH is offline   1 Reply With Quote
Old Jun 11, 2012, 07:07 AM   #7
Albright
macrumors member
 
Join Date: Aug 2011
Quote:
Originally Posted by NathanCH View Post
Actually, Albright, that's not the correct answer. I do agree that it is annoying, but a lot clients do want these sorts of things nowadays and its good to know how to do it.
It's not my opinion that the customer is always right. If the customer wants something that is wrong, you're not doing your job if you don't try to explain to them why that's not a good idea. If they insist, fine, you grudgingly build it, but every stupid thing you're forced to build should come after a hard-fought battle in which you explain to the client that it will do more harm than good.

Quote:
Cmon, even Google uses it.
You say that as if Google is some sort of authority on user interface design. I see that site is also implementing just-in-time image loading, which, while it makes sense on a technical level, is also a user-unfriendly exercise, as it reduces the ability to quickly scan through the page.
Albright is offline   0 Reply With Quote
Old Jun 11, 2012, 03:34 PM   #8
NathanCH
macrumors 65816
 
NathanCH's Avatar
 
Join Date: Oct 2007
Location: Stockholm, Sweden
Send a message via Skype™ to NathanCH
Quote:
Originally Posted by Albright View Post
It's not my opinion that the customer is always right
Well I don't think its wrong. It's definitely a choice. It seems I really hit a nerve on this with you, I just think its a better idea to help him instead of not because you think it's wrong, which begs the question why you even posted
__________________
Design/Development Portfolio: Cetan.ca
NathanCH is offline   1 Reply With Quote
Old Jun 11, 2012, 05:36 PM   #9
John444
Thread Starter
macrumors member
 
Join Date: Feb 2011
Quote:
Originally Posted by NathanCH View Post
Hey, sorry I made a mistake in that code yesterday. I left out the closing tags for the link. Here is a live example:

http://www.cetan.ca/workshop/fixedheader.html

Take a look at the source (and inline css at the top). Let me know if this works for you and if anyone finds a better way
Thanks, Works Great!
John444 is offline   0 Reply With Quote
Old Jun 11, 2012, 06:05 PM   #10
John444
Thread Starter
macrumors member
 
Join Date: Feb 2011
Quote:
Originally Posted by Albright View Post
It's not my opinion that the customer is always right. If the customer wants something that is wrong, you're not doing your job if you don't try to explain to them why that's not a good idea. If they insist, fine, you grudgingly build it, but every stupid thing you're forced to build should come after a hard-fought battle in which you explain to the client that it will do more harm than good.
Trust me if I thought something was wrong, I would let my customer know right then and their and give them my solution. However in this case, nothing is wrong, I don't know why you are so against floating headers. It is a perfectly acceptable way of doing things and is used in many major sites (Google and Facebook included). Your theory is purely based on your opinion of websites, not everyone is like you. Plus I have never had a floating header break while using the spacebar or scroll arrows, sounds like a browser or software issue, not a coding issue.
John444 is offline   0 Reply With Quote
Old Jun 12, 2012, 03:27 PM   #11
morespce54
macrumors 65816
 
morespce54's Avatar
 
Join Date: Apr 2004
Location: Around the World
Quote:
Originally Posted by John444 View Post
...
I know normally an intra page link is <a href="#here">click here</a>
<a name="here" id="here">It loads here</a>
...

No matter if the banner floating thing is "right" or "wrong", don't forget that anchors (like your example above) are nothing more than links. The only difference from an outside link is the pound (#) in href which is just to says: stay on that page.

So basically, you could use any HTML element (with or without CSS) to point your link to.

ex:

Code:
<a href="#here">click here</a>
<div id="" name="here">It loads here</div>
or

Code:
<a href="#here">click here</a>
<p id="" name="here">It loads here</p>
or

Code:
<a href="#here">click here</a>
<img src="" id="" name="here">
or

Code:
<a href="#here">click here</a>
<hr id="" name="here">
or whatever, really!
__________________
..:.::.:.:.::..:.: Oh, I get it. It's very clever :.:.::.:.:.::.:..:.::..:.::.:..:.::.:.::.:.::..
DO NOT OPERATE YOUR COMPUTER UNDER THE INFLUENCE!
morespce54 is offline   0 Reply With Quote
Old Jun 14, 2012, 05:14 AM   #12
Albright
macrumors member
 
Join Date: Aug 2011
Quote:
Originally Posted by John444 View Post
However in this case, nothing is wrong, I don't know why you are so against floating headers. It is a perfectly acceptable way of doing things and is used in many major sites (Google and Facebook included). Your theory is purely based on your opinion of websites, not everyone is like you. Plus I have never had a floating header break while using the spacebar or scroll arrows, sounds like a browser or software issue, not a coding issue.
Why am I against them? Again: They cover up content, they break pgup/pgdn (and by "break," I mean change the expected functionality; it's not a browser issue. The perceptible amount that the page scrolls when you hit pgdn differs because part of the page is not visible), and you also have problems with anchor linking as was the genesis of this thread. There's no upside unless you're awful enough to insist that your site's logo/social network badgets/ad/whatever overlap part of your content. And as I already said, "but Google does it" is hardly a good excuse when it comes to web design (and Facebook does not do this anymore, unless you're referring to the chat tab thingies at the bottom, which are generally off to the right side of the screen and therefore not overlapping the main content area most of the time).

Not a browser or software issue. No, not a coding issue either. Just a bad design issue. Won't somebody pelase think of the visitors!
Albright is offline   -2 Reply With Quote
Old Jun 14, 2012, 07:26 AM   #13
Padaung
macrumors regular
 
Join Date: Jan 2007
Location: UK
Quote:
Originally Posted by Albright View Post
And as I already said, "but Google does it" is hardly a good excuse when it comes to web design (and Facebook does not do this anymore, unless you're referring to the chat tab thingies at the bottom, which are generally off to the right side of the screen and therefore not overlapping the main content area most of the time).

Facebook does still do it, just look at the top of the News Feed for starters.

As a visitor, I rather like it - I find the quick links very handy and it saves me the trouble of scrolling all the way to the top of the page (especially if it has been a busy 'Facebook news' day and the page is long!)
Padaung is offline   2 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:23 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC