/    Sign up×
Community /Pin to ProfileBookmark

Combining External & Internal css to mark selected menus

Hello, this is just a wondering of a thought I had a long time ago but never asked…

It´s about menus and having one link selected.
On a few pages I have underlinks which I use php to include the textfile, which are A href tags. I have put a simpel arrow in a span inside the A tag which is invisible in the external css.

Every A tag has its own class ofcourse

Then on each page inside the Header, I have put an internal css to overule the invisible span to make the selected link arrow visible.

[CODE]
External css:
.selected {visibility:hidden}

Internal css:
.linkA .selected {visibility:visible}

Sub-menu in html wich is included with php include:
<a href=”pageA.php” class=”linkA”>A page <span class=”selected”>&laquo;</span></a>
<a href=”pageB.php” class=”linkB”>B page <span class=”selected”>&laquo;</span></a>
<a href=”pageC.php” class=”linkC”>C page <span class=”selected”>&laquo;</span></a>
<a href=”pageD.php” class=”linkD”>D page <span class=”selected”>&laquo;</span></a>
[/CODE]

So the question is if this method is acceptable or is it a lazy man´s work which is only stupid to mix internal css with external ? Or are there better solutions for this matter perhaps. Then it might be more of a php issue rather than css I guess

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@ray326Sep 22.2006 — The other alternative I've seen is to give the body on each page an ID that's used to highlight the associated menu item.
Copy linkTweet thisAlerts:
@CytaelSep 22.2006 — not sure I get what you're trying to do...you want the arrow beside each link to be visible only when moused over? could do it pretty easy with JS:

[code=php]
<style>
.hideMe { visibility: hidden; }
</style>

<a href="here.php" onMouseOver="document.getElementById('arrow1').style.display='visible';" onMouseOut="document.getElementById('arrow1').style.display='hidden';">Here <span id="arrow1" class="hideMe">&laquo;</span></a>

<a href="there.php" onMouseOver="document.getElementById('arrow2').style.display='visible';" onMouseOut="document.getElementById('arrow2').style.display='hidden';">There <span id="arrow2" class="hideMe">&laquo;</span></a>
[/code]
×

Success!

Help @Siddan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...