Color Change with Mouseover - question

B

Brenda

I am developing a website for my local chiropractor:

http://www.atlasfamilychiropracticonline.com/

Everything is going fairly well, but I'm having one little issue that I
can't resolve.

I wanted to have the color change with mouseovers, and didn't want to create
images for all the buttons, so I used the following in the header:

a {color:#979E69; text-decoration: none}
a:visited {color:#979E69;}
a:hover {color:red;}


It works very well over on the left side of the page, but if you go to one
of the "Chiropractic Conditions" pages:

http://www.atlasfamilychiropracticonline.com/conditions.htm

The mouseovers are not changing colors in the right columns. The hyperlinks
*ARE* working, but it's not obvious, without the mousever working, that they
are hyperlinked.

Can anyone please help me with this problem? (Maybe I need to create buttons
for all those conditions?)

Why is it working on one side of the page, and not on the other side of the
page?

Thank you,
~Brenda
 
K

Kevin Spencer

Hi Brenda,

Here's an example of the problem:

<font face="Tahoma" size="2">
<a href="conditions-arm.htm">
<font color="#000000">Arm Pain</font></a></font>

The "a" tag is the hyperlink. Note the font tag *inside* it, around the
text. This is overriding the style for the hyperlink. If you remove that
inner font tag, it will behave as you expect.

You can also avoid using font tags altogether, as long as all the text is
the same type and size, in your style sheet:

font-face:Tahoma;
font-size:small;
font-color:#000000;

Now, here's another tip: If you set the "a" style as you have, the
font-color style will be overridden by "a" style inside hyperlinks, but will
be the font-color style for any other text in the page.

If you use a font style, you can eliminate any font tags that specify that
face, size, and color.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
B

Brenda

Hi Kevin,

Thank you so VERY much. You have solved my problem. I am a bit slow in
making the corrections (there may be a faster way, but I don't know it yet)
but I am able to correct my problems.

I never could have solved it without you. My sincere THANK YOU.

Brenda
 
M

Murray

This is a good example for why you have to begin looking at the code if you
want to improve your skills. This is one of those problems that you simply
cannot solve when working from Layout view only.... And the solution is
very simple, indeed.
 
B

Brenda

Hi Keven,

I'm not complaining, *but* I have now changed the font in the left hand
column from a light green to black:

(see http://www.atlasfamilychiropracticonline.com/conditions.htm as an
example).

*IF* possible, I would like the left hand columns to be a light green font,
changing to red on mouseover, and the right hand columns to be black font,
changing to red on mouseover.

Is this possible? I changed to styles because I thought I could understand
that better, but I am seeing that styles changed the colors on BOTH sides...
I can live with that, but am wondering if there is a way to get the light
green font set back on the left column. Maybe it looks better when both
sides are black font anyway...??

Thank you,
Brenda
 
B

Brenda

Murray,

I have been looking at my code, and yes, I do want to improve my skills, but
if you could please elaborate and point me in a direction, I would be most
appreciative. I am still fairly new to this, so I need some examples, if you
could, please.

Thank you,
Brenda
 
K

Kevin Spencer

Hi Brenda,

It sounds like you're doing the right thing. If you use the WYSIWYG features
of FrontPage to create web pages, and then look at the HTML that it
generates for you, that goes a long way towards learning HTML. Here are a
couple of web sites that may be helpful as well:

http://www.w3schools.com/
http://www.w3.org/html/
http://www.w3.org/MarkUp/Guide/
http://www.w3.org/MarkUp/Guide/Advanced.html
http://www.w3.org/MarkUp/Guide/Style

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
D

Dan L

Brenda,

Under where you placed the styles for your links place this (you can copy
and paste):

#conditions a {color: #00ff00; text-decoration: none; font-family: Tahoma;
font-size: 10pt;}
#conditions a:visited {color:#006000;font-family:Tahoma; font-size:10pt}
#conditions a:hover {color:#FF0000;font-family:Tahoma; font-size:10pt}

Then on your conditions.htm page look for the <div> tag just before the
table that contains your right-hand side links and add id="conditions". It
will look like this:

<div id="conditions" align="right">

That should do what you want.
 
B

Brenda

Dan and Kevin,

Thank you very much. Kevin, I will read the pages you so kindly gave me in
the links. I know I have a lot to learn, and I do appreciate everyone's
taking the time to help me, and point me in the direction that I need to go.

Dan, thank you for the coding. I will try it. I do thank you as well.

Brenda
 
B

Brenda

Dan,

KUDOS to you! That did it. I do know I have a lot to learn and will follow
up by reading (and hopefully understanding) the pages Kevin gave me.

Thank you so very much, Dan and Kevin.

Brenda
 
K

Kevin Spencer

Hi Brenda,

You can certainly do what you want, but it will require a bit more
understanding of CSS. I sent you some links in another thread. One of them
is an article about CSS called "Adding a Touch of Style." Here'a another
reference you may find helpful:

http://www.htmlhelp.com/reference/css/

But first, let's just get you going on your specific problem. You have a
page with 2 areas that you want to apply different styles to. Now, this is
going to freak you out, because you have no idea how powerful CSS is, and
how it can simplify things, so get ready!

First, let's have a look at your new style sheet:

<style type="text/css">
a
{
text-decoration: none;
font-family:Tahoma;
font-size:10pt
}

..leftMenu td a
{
color: #979E69;
}

..leftMenu td a:hover
{
color: #CCFFCC;
}

..leftMenu td a:visited
{
color: #FF0000;
}

..rightMenu td a
{
color: #2C4B12;
}

..rightMenu td a:hover
{
color: #99FFCC;
}

..rightMenu td a:visited
{
color: #CC3399;
}
</style>

I know, it's a lot different, but it isn't hard to explain. Every CSS style
definition consists of a few basic items:

1. The Selector. The Selector indicates what the style applies to. It is the
part before the opening curly bracket ('{'). Now, you're familiar with using
Selectors that indicate a tag name, like:

a
{
text-decoration: none; font-family:Tahoma; font-size:10pt
}

Note that I've separated it out into lines to make it easier to read. It's
the punctuation that makes a difference, not the line breaks!

Now, this indicates "all 'a' tags." It's a very general Selector. We'll get
to the Rule in a moment. But first, let's look at one of the other Selectors
you've already used:

a:hover
{
text-decoration: none;
font-family:Tahoma;
font-size:10pt
}

Now, this is the same thing as an 'a' selector, but the colon (':')
indicates a "pseudo-class." This is a special kind of "class" (indicating a
"class" or "group", sort of in the same way that "middle class" indicates a
group). It subdivides the 'a' into another group that includes 'a' elements
with the mouse cursor "hovering" over them. The same is true for the
"visited" pseudo-class, which is an 'a' tag pointing to a URL that the user
has been to before.

Now I'm going to introduce you to the concept of a "class Selector." A class
Selector always starts with a dot ('.'). If it starts with a dot, it's a
class. A class, again, is a group of HTML elements. These are elements with
a "class" attribute in them. Here's a simplified version of the first class
in the style sheet:

..leftMenu td
{
color: #979E69;
}

Now, in this case, the class is "leftMenu." So, any HTML element that has a
"class" attribute named "leftMenu" is in this class, and has this style
applied to it. Here's an example from your page:

<table class="leftMenu" border="0" id="table2" bordercolordark="#008000"
bordercolorlight="#008000">
<tr>
<td align="center"><a href="doctor.htm"><br>
About The Doctor</a></td>
</tr>

Now, this is the same as the HTML that was already there for your left menu,
with a "class" attribute added to the table tag. This table is now in the
class "leftMenu."

Anything after a space and before the left curly bracket is a further
refinement of the class. In this case, "td" indicates a table cell, or "td"
element, like the first one in my example above. This means that a td
element inside a table with the "class" attribute set to "leftMenu" is
selected for that rule to be applied.

But wait! There's more! I left out just a wee part of the style definition:

..leftMenu td a
{
color: #979E69;
}

Again, there's a space, indicating that the "a" tag is inside the "td" tag
inside a table with the class "leftMenu." Now we're getting very specific
about the style rule's application. It "selects" all of these elements.
That's why it's called a "Selector."

One more thing, and remember, this is just an introduction. You saw my
modified "a" rule, right? Note that the "leftMenu" rule doesn't contain any
information about the font to be used. That's because it's defined in the
more general rule for all "a" tags. Yes, the same rule gets applied to all
classes for that same tag. It's called "inheritance." They "inherit" the
rule from the "a" tag rule (unless they override it, but let's not worry
about that today!).

Now, for the second part:

2. The Rule. The Rule defines the style that is applied to the
Selector-selected elements. It is everything between the curly brackets.
This is composed of one or more "Properties." A Property is a property of
the element:

a:hover
{
text-decoration: none;
font-family:Tahoma;
font-size:10pt;
}

This rule has 3 properties: "color," "font-family," and "font-size." Each
property has a name, followed by a colon, followed by the value for that
property, and a semi-colon as the end of the property, like the end of a
sentence. The above rule can be translated like this:

The text will not be underlined (decorated).
The Font Family of the text is Tahoma.
The size of the text is 10pt.

So, what we have is a general Selector, "a" - which applies to all
hyperlinks, and defines a few rules about the text. Then we have 2 classes,
"leftMenu" and "rightMenu." Each of these has 3 rules, one for all links in
all table cells in all tables of that class, and 2 for the more specialized
links, "hover" and "visited," which define different colors that are used
when the links are hovered over by the mouse, or have been visited before by
the browser.

Once that is done, the classes are applied to the tables that they are used
in, one for the left menu table:

<table class="leftMenu" border="0" id="table2" bordercolordark="#008000"
bordercolorlight="#008000">
<tr>
<td align="center">
<font size="2" color="#979E69" face="Tahoma">
<a href="doctor.htm"><br>
About The Doctor</a></font></td>
</tr>

....and one for the right table:

<table class="rightMenu" border="0" id="table5" align="right"
bgcolor="#979E69">
<tr>
<td style="border-bottom-style: solid; border-bottom-width: 1px">
<b><font face="Tahoma" size="2">Do you have any
of these <br>
symptoms or conditions?</font></b></td>
</tr>
<tr>
<td style="border-bottom-style: solid; border-bottom-width: 1px">
<a href="conditions-arm.htm">Arm Pain</a>
</td>
</tr>

Notice that there is no more font style around the hyperlinks. It isn't
needed!

Those style rules are automatically applies to all of the links in all of
the cells of each of those tables.

I hope this whets your appetitite to learn more about CSS!

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
B

Brenda

Kevin,

I most certainly do thank you for your most kind explanation of CSS. You
are most certainly correct - I did not realize that CSS were that powerful
(and I didn't know how to "read" them.)

I will reread your information a few more times, to hopefully retain what I
read. Your explanation makes what I see a *lot* more clear.

Thank you again ~ without your taking the time to explain how to read CSS,
they don't mean a lot (to me).

Brenda
 
B

Brenda

Kevin,

I want to thank you again for the links to read. I'm still reading and
learning. You are most certainly correct - CSS is very powerful (and in my
opinion, "the" way to go.) It will take me a long time to become proficient,
but I'm starting to learn, and will (eventually) use an external CSS for my
website.

Thank you again,
Brenda
 
B

Brenda

Dan,

If I could bother you once more, I seem to have broken my mouseovers on the
left side of the page on my site in the "conditions" portion -- here is an
example:

http://www.atlasfamilychiropracticonline.com/conditionsnew.htm


I want those links of the left side to turn red with the mouseover. I'm not
sure what I did that broken that. If you could please help, I would be most
grateful.

I've switched to DWT's, although this page (my test) is not using DWT's. I
"think" I am starting to get the idea of DWT -- and it seems to be a very
easy way to have all pages look and act alike (which is a good thing if they
are all acting correctly.)

Thank you again, Dan and Kevin, for your help.

Brenda
 
B

Brenda

Dan,

If I could bother you once more, I seem to have broken the mouseover (from
green font to red) on the left hand side of my conditions pages. I have a
"test" page that I am working with as an example.

http://www.atlasfamilychiropracticonline.com/conditionsnew.htm

If you could please tell me what to change in the code, I would be most
grateful (again). I am not figuring out what I need to change in the code.

I've switched to DWT on my pages and thanks to everyone here, have figured
out that DWT is a very good way to have all pages look and act the same.

Thank you again, Dan and Kevin.

Brenda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top