Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

questions about CSS Style sheets

I am trying to modify a web page which references an external CSS style sheet.

I am trying to change the color and located the classes that seem to be refrencing the css.

However, I dont under this this.  Are these links, active etc using the parameters from the visited section or some other place in the CSS


body.LeftMenu08 .sectionentity08 a,
body.LeftMenu08 .sectionentity08 a:link,
body.LeftMenu08 .sectionentity08 a:active,
body.LeftMenu08 .sectionentity08 a:visited
{
      display:block;
      padding:3px 10px 3px 15px;       
      color:#666;
      background:#fff1c4;
      width:100%;
      text-decoration:none;
}
0
red_75116
Asked:
red_75116
2 Solutions
 
QuinnDexCommented:
they are links or anchor tags, the reference is the link relevant to other classes within the css

the style wouldn't apply to all links on the page only links that feel within the hierarchy body.LeftMenu08 .sectionentity08 a
0
 
Scott Fell, EE MVEDeveloperCommented:
It is applying the same class to the link, visited and active state.   If you want to use different colors you would use:

body.LeftMenu08 .sectionentity08 a:link

{
      display:block;
      padding:3px 10px 3px 15px;       
      color:black;
      background:#fff1c4;
      width:100%;
      text-decoration:none;
}
body.LeftMenu08 .sectionentity08 a:hover

{
    
      color:red;

}
body.LeftMenu08 .sectionentity08 a:visited

{
      
      color:blue;

}

Open in new window


Notice you only need the details for the a:link and for hover, visited etc, you only need to change the color or the background or both.
0
 
COBOLdinosaurCommented:
However with that said there is still no guarantee that those are the styles that actually get applied.  If there are other rules declared with more specificity; the same level of specificity at a later point in the listing order; inline; or generated overrides from scripting, then the actual application of rules cannot be determined without looking at the whole page.

All you have there is a fragment, that might or might not even apply to the page you are looking at.  CSS is extremely dynamic and out of context a declaration is really no more relevant than a single word in a 200 page book.

Cd&
0
 
Scott Fell, EE MVEDeveloperCommented:
I agree, I would name the styles a little better.  These look like they were from a theme or automated html creator.  

Better to have a style that is global like below

 a:link
{
      display:block;
      padding:3px 10px 3px 15px;       
      color:black;
      background:#fff1c4;
      width:100%;
      text-decoration:none;
}
 a:hover
{
      color:red;
}
 a:visited
{
      color:blue;
}

Open in new window

Then for something special, create some unique styles
.special a:link
{
      display:block;
      padding:3px 10px 3px 15px;       
      color:red;
      background:#fff1c4;
      width:100%;
      text-decoration:none;
}
.special a:hover
{
      color:blue;
}
 .special a:visited
{
      color:green;
}

Open in new window

0
 
red_75116Author Commented:
Thanks for your replies.  I agree the format is confusing.  There is one style sheet for each theme for the entire site.  I was having trouble following it, but your comments helped me sort it out.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now