943,547 Members | Top Members by Rank

Ad:
Nov 19th, 2008
0

CSS external style sheet EW2 can not use a:hover etc

Expand Post »
Hi

I am using MS Expression Web 2 migrating from Frontpage 2002. I have decided to try to produce an up to standards web site using CSS and this doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-as suggested by an article Getting Started or similar that I think I read on a MS blog.

I am having quite a lot of trouble and wish I had stuck to tables for layout! But I have made progress as Expression Web 2 is very nice to use.

I am currently stuck on designing a horizontal navigation bar. I have used the DL tag in the HTML and a class called "menu" for the formatting. I can't add
"a:hover" though or any of the other hyperlink formatting commands to the CSS file. EW2 justs underlines the "a" as being not acceptable. It won't accept any code beginning
with "a" in the CSS at all. As soon as I type "a" it unlines it as being unacceptable. My CSS file uses "link rel . . " in the web pages.

Consequently I have added a style sheet to the web page in the Head section using the File - Properties dialogue. since every page of the web will have the same
navigation bar it does seem silly not to be able to include the code in the CSS external file though. Does anyone know what I am doing wrong?
Reputation Points: 6
Solved Threads: 0
Junior Poster
ggeoff is offline Offline
169 posts
since Aug 2007
Nov 19th, 2008
0

Re: CSS external style sheet EW2 can not use a:hover etc

I found that it is possible to by using "Manage Styles" to move a style from an internal CSS to an external CSS or vice versa -just be dragging it. So I dragged it from the page to the external CSS to the class "menu" It worked but didn't put it in the "menu" class but just above it. I have now added the code for "visited" and it works.

I am a little wiser, I think? But is there some order in which a style is added to the external CSS? And what's the best way of working -work at page level and move internal defined styles to the external file?
Reputation Points: 6
Solved Threads: 0
Junior Poster
ggeoff is offline Offline
169 posts
since Aug 2007
Nov 19th, 2008
0

Re: CSS external style sheet EW2 can not use a:hover etc

If you used class menu directly on a element, then instead of using a:hover in your css, you should use .menu:hover, .menu:visited, etc...
On the other hand, if you have applied menu class to your DL tag, then you should define your links like
.menu a:link, .menu a:visited, etc...
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Nov 19th, 2008
1

Re: CSS external style sheet EW2 can not use a:hover etc

To your last you have just posted.

the correct order to define styles for a link is
a:link, a:hover, a:visited and optionally a:active

As for the question where to do css coding - inside page or in an external file - it is easier to work with an external file, because you can keep both files opened one next to other and you will not have to scroll up and down as you would do with a single file.
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Nov 19th, 2008
0

Re: CSS external style sheet EW2 can not use a:hover etc

Click to Expand / Collapse  Quote originally posted by Rhyan ...
If you used class menu directly on a element, then instead of using a:hover in your css, you should use .menu:hover, .menu:visited, etc...
On the other hand, if you have applied menu class to your DL tag, then you should define your links like
.menu a:link, .menu a:visited, etc...
Thanks Rhyan

I have the menu class applied to the DL tag and have added the code as you have suggested and it works fine.
Reputation Points: 6
Solved Threads: 0
Junior Poster
ggeoff is offline Offline
169 posts
since Aug 2007
Nov 19th, 2008
0

Re: CSS external style sheet EW2 can not use a:hover etc

Click to Expand / Collapse  Quote originally posted by Rhyan ...
To your last you have just posted.

the correct order to define styles for a link is
a:link, a:hover, a:visited and optionally a:active

As for the question where to do css coding - inside page or in an external file - it is easier to work with an external file, because you can keep both files opened one next to other and you will not have to scroll up and down as you would do with a single file.
Thanks Ryhan but the order of the define styles for a link is:
a:link, a:visited, a:hover and a:active; otherwise the hover won't work after the link's been visited. ( I checked on w3schools)

Thanks for the advice about which is easier. And thanks once again for helping me with this - it was keeping me awake at night!

Geoff
Reputation Points: 6
Solved Threads: 0
Junior Poster
ggeoff is offline Offline
169 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: how to code textcolor in html
Next Thread in HTML and CSS Forum Timeline: Layout Sample #2





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC