473,725 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Navigati on"> /* 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.h tm">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\St yle001.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\St yle001.css
Line: 64
Parse Error - : link
Line: 69
Parse Error - : visited
Line: 74
Parse Error - : hover
*/



Aug 30 '05 #1
3 3389
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\St yle001.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****@stanford alumni.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
2322
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 problem with reconstructing the target "Location" http header because I'm missing just one thing. My links look as follows: http://www.oldurl.com/beanie.php#three?register=false&demt=43
2
4116
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 the test is true - since there will be several different named anchors in the page. I don't think this is very advanced, but I'm new to JavaScript . I code the link like this: <p><span id="currentlink"><a href="techpage.php#tech02"...
6
13374
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... html file (generated using .NET 2.0 beta2): <form method="post" action="Test2.aspx" id="form1">
21
2476
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
5738
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 need to use Javascript at runtime to go through, find each instance of a link with the above string and change it. Is there a good cross-browser way of achieving this? Is HTMLAnchorElement a good place to start? Thanks
12
2369
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 text</a> . Could be further complicated by the ASP and SQL designation of URL. like: http://sampleURL.org/FAQs.asp?FAQMID=11&NumFaq=10&bmode=Main W3C validator said 91 errors, mostly on tables, fonts and graphics, but didn't seem to complain about...
2
3129
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. Is there any way to do this? Presumably I could just read the coords of the region, create a floating layer dynamically, and change the color, no? Unfortunately, I can't manage to read the coords property, and I'm not entirely certain how to...
3
16555
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 HREFS
6
1823
by: vinniemac | last post by:
Using javascript, how can I change an attribute for ALL anchors (A:hover) on the webpage?
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.