Please help! (CSS)

robfenn's picture

He has: 471 posts

Joined: Jun 2005

One of the reasons i haven't really got going with CSS is that seemingly easy stuff goes wrong for me (i appreciate i might be the deciding factor in this). I have an example for you which i really need to fix!

If you visit this page you will see one of the menu items is underlined, but in the style sheet it defines no decoration on links until hovered over. So how comes that one bugger doesn't play ball?

Here is the link to the stylesheet:

http://www.sarahspetportraits.co.uk/style.css

(The menu uses H2)

Thanks,

-Rob

robfenn's picture

He has: 471 posts

Joined: Jun 2005

Just noticed this is in the wrong section. Can someone move it to web page authoring?

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

H1 & H2 are headings and should be that, not links. Style your links (a, a:hover, a:active) to act as you want them or create a class for styling the navigation separately from other links on the page.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

robfenn's picture

He has: 471 posts

Joined: Jun 2005

Julia,

If you look at the style sheet link, hover and active are both defined as "text-decoration: none" Which should mean they are not underlined.

I know it shouldn't be called H2, lazyness on my part, but does that actually make a difference?

Thanks,

-Rob

They have: 2 posts

Joined: Oct 2005

Hi.

I just looked at your css-file.
You might want to check line nr. 11:
h2 a:hover {color: #413833; text-decoration: underline}
This is probably why you get the links underlined...

B

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

It's because all of the other links are pointing to the current page and therefore showing up as visited links which has the text-decoration:none applied. The link definition does not have the text-decoration applied specifically - it's applied to the H2 tag which gets overriden by the default settings for the a tag.

I agree that it would be best to create a class for this rather than relying on the H2 tag.

robfenn's picture

He has: 471 posts

Joined: Jun 2005

Well done guys! Works now Laughing out loud

robfenn's picture

He has: 471 posts

Joined: Jun 2005

Sorry to annoy you again but i'm having more troubles...

Both Firefox and Opera are ignoring my P class styles, making the links the default blue. If Internet Explorer is so bad then why does it display everything as i intended? Wink

Here is a link:
http://www.sarahspetportraits.co.uk/pet-portrait-portfolio.htm

And the stylesheet again:
http://www.sarahspetportraits.co.uk/style.css

Thanks in advance.

-Rob

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Um... You have this:

h4 {font-family: arial; font-size: 9pt; color: #413833}; text-decoration: none;}
'

This happens several times in your code, try changing it to this:

h4 {font-family: arial; font-size: 9pt; color: #413833; text-decoration: none;}
'

robfenn's picture

He has: 471 posts

Joined: Jun 2005

I could kiss you.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

hey rob theres actually a css tidy tool that checks for your CSS or go to the CSS validation service and it will validate your CSS file and will show you some errors you missed... Good to know youre keen on learning CSS...

robfenn's picture

He has: 471 posts

Joined: Jun 2005

Yeah, shame i'm lame at it! I'm not a born coder i'm afraid.

I will endeavour to improve though, i might do a course or something.

Should of though of using the W3C Validator, duh!

Cheers

-Rob

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.