473,387 Members | 1,542 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,387 software developers and data experts.

How to change the properties in SOME anchors?

Hi all, newbie here.

Odd sounding subject but I can't describe it any better.

I'm trying to teach myself a little about CSS. In a test site (not
published) I am trying to use CSS to make navigation buttons. I'm
using the tutorial I found at this site as a basis for it.

http://www.mako4css.com/TFonts.htm

In it he adds a subclass to the anchor class and calls it 'nav'. I've
tried using the same tactic but it doesn't work for me. This is a cut
and paste from my external .css file.

a.nav: link{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

a.nav: visited{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

a.nav: hover{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

It's given various properties and called from the HTML using this...

<div class="Navigation"> /* This defines an absolutly positioned box
on the left of the page for a navigation area. */

<div class="navbox" /* this draws a bordered box within the navigation
area for the anchor to fit in and it too works ok */>
<a class="nav" href="page001.htm">page001</a> /* This is the
problem. This anchor gets placed in the navbox OK and says what I
want, but it uses the default properties for links. I can't remove
the underlining or change the colouring as I'd like to define in my
stylesheet. */
</div>

<div class="navbox">Testing, testing</div> /* The colors for this non
anchor text can be set easily */

</div>

I've tried running it through a CSS validator and got this error:

Errors
URI : file://localhost/E:\Thunderin\Style001.css
Line: 64
Parse Error - : link
Line: 69
Parse Error - : visited
Line: 74
Parse Error - : hover

It seems that the properties above aren't recognised. OK, it works on
the tutorial site so what have I done wrong to my version? I CANNOT
see any differences in syntax etc. Can someone please explain why my
a.nav definitions are not seen / valid / correct?

Many thanks.


************************************************** ****************
style001.css
************************************************** ****************

body {
background-color : #ffffff;
background-image: url(bluish.jpg);
background-repeat: repeat-y;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #000099;
margin: 0px;
}

..Navigation {/*The navigation on the left side, positioned
absolutely*/
position: absolute;
top: 100px;
left: 11px;
width: 135px;
height: auto;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color: #000099;
background-color: #ccffff;
line-height : 130%;/*line-height set to 130% in order to*/
} /*have the navigation elements better
separated*/

..Main {/*this is the main content area*/
background: #ffffff;
color: #000099;
margin-left: 160px; /*to position the content area to the right
of the navigation*/
margin-right: 20px; /*breathing space for the text*/
padding: 5px; /*space to separate navigation and content*/
font-family : Verdana, Eyechart, Geneva, Arial, Helvetica,
sans-serif;
width: auto;
text-align: center;
border: 0.1px solid #FFFFFF; /*to insure that NN4.xx renders the
background-color of the content area*/
}

..box01{ /* Footer box */
background: #ffffff;
color: #000099;
font-family: arial, tahoma, verdana, helvicta, sans-serif;
font-size: 12px;
padding: 2px;
margin: 2px;
border-color: #3399ff;
border-style: groove;
border-width: 2px
}

..navbox{/* Navigation boxes */
background: #ff2222;
color: #ffffff;
font-family: arial, tahoma, verdana, helvicta, sans-serif;
font-size: 15px;
text-align: center;
padding: 1px;
margin: 2px;
border-color: #3399ff;
border-style: groove;
border-width: 2px
}

/* These next classes ***should*** provide the properties I want for
the text in the links of the anchors within the navboxes. If you see
what I mean! */

a.nav: link{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

a.nav: visited{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

a.nav: hover{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}

/*
Errors
URI : file://localhost/E:\Thunderin\Style001.css
Line: 64
Parse Error - : link
Line: 69
Parse Error - : visited
Line: 74
Parse Error - : hover
*/



Aug 30 '05 #1
3 3368
Mike Barnard <m.****************@thunderin.co.uk> wrote:
a.nav: link{
color: #ff3333;
text-decoration: none;
font-weight: 600;
font-size: 14px;
background: transparent
}
[...]

I've tried running it through a CSS validator and got this error:

Errors
URI : file://localhost/E:\Thunderin\Style001.css
Line: 64
Parse Error - : link
[...]

It seems that the properties above aren't recognised. OK, it works on
the tutorial site so what have I done wrong to my version?


You've put whitespace (a tab) between the colon and the name of the
pseudo-class. You need to change the selector from

a.nav: link { ... }

to

a.nav:link { ... }

While you're at it, font sizes in px (or pt) are generally inappropriate on
the WWW. See http://css.nu/faq/ciwas-aFAQ.html#QA02
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Adventure is nothing but a romantic name for trouble." - Louis L'Amour
Aug 30 '05 #2
Mike Barnard wrote:
http://www.mako4css.com/TFonts.htm

In it he adds a subclass to the anchor class and calls it 'nav'. I've
tried using the same tactic but it doesn't work for me. This is a cut
and paste from my external .css file.


Not exactly. You added spaces where there shouldn't be: in between ":"
(colon) and the following word.

:link{ something... } is valid but

: link{ something... } isn't.

Try again this way:

a.nav:link{
blahblah...
}

a.nav:visited{
blahblah...
}

a.nav:hover{
blahblah...
}

Just my 0.02 Euro,

--
==================
Remi Villatel
maxilys_@_tele2.fr
==================
Aug 30 '05 #3
On Tue, 30 Aug 2005 01:20:37 +0100, Mike Barnard
<m.****************@thunderin.co.uk> wrote:
Hi again.

Thanks for the replies. I know I'm new, but I didn't know that
whitespace is forbidden in some places. I was just trying to make my
code more readable by lining stuff up. I'll have to do some more
reading about CSS syntax, methinks! BUT, my test page now works!
Yahoo.

Also, I now know that I shouldn't use font sizes in the way the
'tutorial' describes. Thanks for the pointer.

It'll be a while before I get more research done 'cos of work etc but
I'll be lurking.

Again, thanks.

Aug 30 '05 #4

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

Similar topics

7
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
2
by: deko | last post by:
I'm trying to change the font style of a link when that link is clicked. But the link (sometimes) includes a named anchor. So I need to test for a given named anchor and apply style changes if...
6
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... ...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
5
by: contact | last post by:
I need to change all the links on my site that say "more information" to something else. Unfortunately I don't have access to change the component that places these links in the first place, so I...
12
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of...
2
by: spamforsteve | last post by:
Hi, all! I have an imagemap of a floor of offices. I have various events and an onclick function working just fine, but I'd like to be able to change the color of the region being hovered over. ...
3
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A...
6
by: vinniemac | last post by:
Using javascript, how can I change an attribute for ALL anchors (A:hover) on the webpage?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.