...

View Full Version : Anchors in CSS to link above



Sadak
04-27-2011, 05:58 PM
I have a webpage with four divs. In between each div there is the same menu linking within the page through anchors.

It looks like that:

MENU a
Content 1
MENU b
Content 2
MENU c
Content 3
MENU d
Content 4

Now the menu, as I said before, it's always the same, but I noted it with a, b, c and d for better understanding.

If I try to access Content 4 from MENU a, it's possible. But once I try to access Content 2 from MENU d, for example, I can't, because it seem the anchors in the menu can't read what it's above them in the HTML code.

But they should work, because that's how that #up anchor works in Wordpress and PHP. A solution, please?

abduraooft
04-27-2011, 06:02 PM
Please post your code or a link to your page.

Sadak
04-27-2011, 06:09 PM
<div id="nav_portfolio">
<ul>
<li><a href="#thumbnail" style="color:#666">web</a></li>
<li><a href="#mobile">mobile</a></li>
<li><a href="#mockups">mock-ups</a></li>
<li><a href="#other">other</a></li>
</ul>
</div>


<div id="web">
</div>


<div id="nav_portfolio">
<ul>
<li><a href="#thumbnail">web</a></li>
<li><a href="#mobile" style="color:#666">mobile</a></li>
<li><a href="#mockups">mock-ups</a></li>
<li><a href="#other">other</a></li>
</ul>
</div>

<div id="mobile">
</div>

<div id="nav_portfolio">
<ul>
<li><a href="#thumbnail">web</a></li>
<li><a href="#mobile">mobile</a></li>
<li><a href="#mockups" style="color:#666">mock-ups</a></li>
<li><a href="#other">other</a></li>
</ul>
</div>


<div id="mockups">
</div>

<div id="nav_portfolio">
<ul>
<li><a href="#thumbnail">web</a></li>
<li><a href="#mobile">mobile</a></li>
<li><a href="#mockups">mock-ups</a></li>
<li><a href="#other" style="color:#666">other</a></li>
</ul>
</div>

<div id="other">
</div>

abduraooft
04-28-2011, 10:45 AM
<li><a href="#thumbnail">web</a></li>
Don't you need #web instead?

btw, you can't use the same id for multiple elements inside a document. Use class instead.

Sadak
04-28-2011, 02:37 PM
Don't you need #web instead?

btw, you can't use the same id for multiple elements inside a document. Use class instead.

Yes, it is #web instead of #thumbnail, I renamed the CSS Div and I forgot to rename it in HTML.

I assume the problem is the fact that I used the same id more times inside a document, which was something I was not aware of. I thought this can be done.

Thanks for the help!

effpeetee
04-28-2011, 07:38 PM
This may help you to understand. (http://www.tizag.com/cssT/cssid.php)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum