Avatar of Bradley Smith
Bradley SmithFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Override CSS Rule

Hey Guys,

I have built a website using Dreamweaver & an external CSS style sheet, that controls the colours of my hyperlinks.  Things such as Hover, Colour when clicked and the colour of the link.  On one of the pages i want one link to be a different colour to the rest.  

I highlighted my text i want to be different, and clicked new CSS rule, i then selected Class, give it a new name of pdf_link, clicked OK & defined how i wanted it to look.  I then selected the style pdf_link to the highlighted text but it seems as if it is getting over ridden by my first CSS that exists for the other links on the page.  How can i fix this so i can make one link what ever colour i want and it is not defined by the original CSS rule.

My code says this: class="pdf_link">here</a>

Thanks
CSSHTMLAdobe Dreamweaver

Avatar of undefined
Last Comment
kadaba
Avatar of theodorejsalvo
theodorejsalvo
Flag of United States of America image

The order in which the CSS loads determines what gets applied to it.  Your code is fine.
Avatar of kadaba
kadaba
Flag of India image

if you want to force a style then add important! to that property.
Avatar of Bradley Smith
Bradley Smith
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

why is the colour of the one link not changing then?  i have defined it in the external style sheet but it is not changing.  

in my external style sheet i have this:

A:link {

      color: #666666;
      text-decoration:none;
}



A:visited {

      color: #666666;
      text-decoration:none;
}



A:hover {

      color: #800122;
      text-decoration:underline;
}



a:hover.m {

      color: #1E5AAB;
      font-weight:bold;
      text-decoration:none;
}
.pdf_link {
      font-family: Geneva, Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-weight: bold;
      color: #0000FF;
      text-decoration: underline;
}

Thanks
Avatar of LZ1
LZ1
Flag of United States of America image

Try this for your css:
 

.pdf_link a {
      font-family: Geneva, Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-weight: bold;
      color: #0000FF;
      text-decoration: underline;
}

Open in new window

Avatar of Bradley Smith
Bradley Smith
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

it goes bold, but the colour does not change, it says it is blue in the rule, but when the text is clicked in dreamweaver text colour is grey.  I cant even select the text and say blue.
Avatar of J3NN1F3R
J3NN1F3R
Flag of United States of America image

Assuming you want the same color and other styling for all states (visited, active, hover), this should fix your problem.
.pdf_link a:link, .pdf_link a:visited, .pdf_link a:active, .pdf_link a:hover {
      font-family: Geneva, Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-weight: bold;
      color: #0000FF;
      text-decoration: underline;}

Open in new window

Avatar of Bradley Smith
Bradley Smith
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Im copying and pasting this from here into my external style sheet call style.css, im then highlighting the link i want to be different and selecting pdf_link from the style list.  saving both and previewing & it does not make any difference, im so confused!
Avatar of LZ1
LZ1
Flag of United States of America image

Please post all of your code or post a live link.
ASKER CERTIFIED SOLUTION
Avatar of stehardy88
stehardy88
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of kadaba
kadaba
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
HTML
HTML

HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.

62K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo