473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Looking for a solution to CSS, presenting links in two different ways...

Hello all,

I want two sets of links to do different things; one set within *content*
and the other *navigational* elements. In particular I want the *hover*
rollover effect to work differently in each of those sets.

How do I do this in CSS? Class function... two style sheets? I'm lost,
please help! : =)

Newbie to CSS,

Isabelle
http://www.is.visisoul.com
Jul 20 '05 #1
4 2917
Isabelle schreef:
I want two sets of links to do different things; one set within *content*
and the other *navigational* elements. In particular I want the *hover*
rollover effect to work differently in each of those sets.

How do I do this in CSS? Class function... two style sheets? I'm lost,
please help! : =)

Newbie to CSS,


One stylesheet will do. Create a text-file with extention .css.
Link it to your pages in the <head> as
<link rel="stylesheet" type="text/css"
href="../stylesheets/stylesheet.css"> <!-- where the href of course
matches the path and name of your stylesheet -->

Start with the 'normal' links, the ones you want to use in the body of
your text. Maybe even don't do anything at all with them, so people will
see the links as are (I know; I don't obey this 'rule' myself). Mind the
order in which links are processed, so:

a {style here}
a.visited {style here}
a.hover {style here}
a.active {style here}

In the body of the text you don't have to do anything to make the links
look as you just specified in your stylesheet.

If you're satisfied about the way your links look in the body of the
text, then create new styles for your menu by (for examle) creating a
class .menu:

.menu a {style here}
.menu a.visited {style here} etcetera

Now, in your mark-up make sure you create an element for your menu that
has the class=menu, like:

<div class="menu">menu here</div>

All links inside that element will be styled according to the styles you
gave to .menu a etc.

The hover is a bit tricky. On text-menus it works well. The trick is to
give the .menu a (and the others) a style like this (block and 100% widht!):
.menu a
{ display:block;
width:100%;
backgroundcolor:blue; } /*this blue is just an example*/

.menu a:hover
{ display:block;
width:100%;
backgroundcolor:yellow; } /*again, just an example*/

and any other style you want to put in there.

Now difine yourself a 'box' in which you will put those menu-links:
.menu-container
{ position:absolute;
top:[...px];
left:[...px];
background:white;
width:[...px]; }
Mind you, with these settings you can position your menu exactly on
screen where you want it to bee, but the size is not 'liquid' (see
Stephen Poley's site for information on this:
<http://www.xs4all.nl/~sbpoley/webmatters/> )

You're free to go through my stylesheet:
<http://home.wanadoo.nl/b.de.zoete/stylesheets/styles.css>

and the relevant pages to see the effect work:
<http://home.wanadoo.nl/b.de.zoete/index.html>

Links in body of text and in menu are different. Menu has a hover-effect.

When I started building my site (about three months ago) I downloaded
the CSS2 spec's from W3C. They were a bit tough to go through, but were
a great help in the end:
<http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.zip>

Hope this helps, good luck

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html *Dagboek*
http://home.wanadoo.nl/b.de.zoete/html/vliegen.html *Zweefvliegen*?

Jul 20 '05 #2
In article <9q*****************@news20.bellglobal.com>, Isabelle wrote:
Hello all,

I want two sets of links to do different things; one set within *content*
and the other *navigational* elements. In particular I want the *hover*
rollover effect to work differently in each of those sets.

Read
http://www.w3.org/TR/CSS2/selector.html
It will save you heaps of time later. Also find FAQ lists, this and many
more questions answered regularly.
two style sheets?
No, two style rules.
I'm lost, please help! : =)


Do you have your navigational links wrpaped on some elements? Give those
elements class="navigation", and use:
..navigation a:hover {}
You can also use class on A elements, if your navigational links are
scattered all around illogically:
a.navigation:hover {}

Of course, it may not be necessary to have any new class, but impossible
to say without URL.
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #3
"Isabelle" <is****************@REMOVEZETHECAPSis.visisoul.com .invalid> wrote
in message news:9q*****************@news20.bellglobal.com...
Hello all,

I want two sets of links to do different things; one set within *content*
and the other *navigational* elements. In particular I want the *hover*
rollover effect to work differently in each of those sets.


Create your default link effects that will appear in your content
a:link {...}
a:hover {...}

And then you have a couple ways of doing the link effects for your
navigation. You could create a class to go on your links:
CSS: a.external:hover {...}
HTML <a href="hello.html" class="external"></a>

or use a descendant selector link so:
CSS: #nav a:hover {...}
HTML <div id="nav"><a href="hello.html"></a></div>

the # is an id selector so it means that the style will apply while hovered
over a link contained within an element with the id equal to "nav".

Good luck,

Jonathan
www.snook.ca
Jul 20 '05 #4
Thank you for the feedback, I'm going to go through everyone's advice and
then report back here next week. :)

Isabelle
http://www.is.visisoul.com
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: opt_inf_env | last post by:
Hello all, I know that in html to set colors of visited and activ links one need to use line in the following format: <BODY text="#FF0000" link="#0000FF" alink="#FFFF00" vlink="#00FF00"> ...
1
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
1
by: Bijoy Naick | last post by:
I've made multiple posts re different aspects of dynamically adding web and user controls.. First off, thx for all the responses.. I think I've figured it out. I am looking for some feedback on...
8
by: rviray | last post by:
I am just looking for opinions about this project that I am working on. Background: Windows Application built under Delphi. The application uses 4-5 (depending on drill down avenue) deep modal...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
23
by: walterbyrd | last post by:
Way back when, I got a lot of training and experience in highly structued software development. These days, I dabble with web-development, but I may become more serious. I consider php to be an...
13
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those...
0
by: Gabriel Genellina | last post by:
QOTW: "Python is a revelation to me as a language that grows with the ability of the programmer, which creates a multi-level community not too centered on one-upmanship to nurture new talent." -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.