School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,136 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,940 people online right now. Registration is fast and FREE... Join Now!




CSS and links

 

CSS and links

Bredge

25 Oct, 2009 - 10:32 AM
Post #1

D.I.C Head
**

Joined: 14 Dec, 2008
Posts: 105


My Contributions
Say I have a stylesheet that contains the following

CODE
a:link {
    color: #000000;
    text-decoration: none;
}

a:active,
a:visited {
    color: #000000;
    text-decoration: none;
}

a:hover {
    color: #f60000;
    text-decoration: underline;



As this is the rule I want to use for all the links on the site, but I want to create a menu that ignores this rule so I have added this

CODE
.site_menu {
    margin: 1px 1px;
    font-size: 1.1em;
    color: red;
    padding: 5px;
    background-color: #f6fe14;
}

.site_menu:visited     {  text-decoration: none; font-size : 11px; color : #f0fe50 }
.site_menu:hover       {  text-decoration: none; font-size : 11px; color : #f0fe50 }


But the links in the menu still adhere to the first rule regarding links. Am I missing something or is this not possible ??

Cheers

User is offlineProfile CardPM
+Quote Post


BetaWar

RE: CSS And Links

25 Oct, 2009 - 11:55 AM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 4,779



Thanked: 277 times
Dream Kudos: 1400
My Contributions
Are you giving the links the class name like so:
CODE
<a href="" class="site_menu">Some Link</a>


Or are you having the links in a div (or other container) that has the class name sitemenu?

If the second you need to change your CSS to something like this:
CODE
.site_menu  a{
    margin: 1px 1px;
    font-size: 1.1em;
    color: red;
    padding: 5px;
    background-color: #f6fe14;
}

.site_menu a:visited     {  text-decoration: none; font-size : 11px; color : #f0fe50 }
.site_menu a:hover       {  text-decoration: none; font-size : 11px; color : #f0fe50 }


In short, yes you can overwrite rules for CSS based on how you set it up. It just requires that you do it in the right way.
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 02:55PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month