Solved

questions about CSS Style sheets

Posted on 2013-12-08
5
341 Views
Last Modified: 2013-12-08
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
Comment
Question by:red_75116
5 Comments
 
LVL 9

Expert Comment

by:QuinnDex
Comment Utility
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
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 250 total points
Comment Utility
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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 250 total points
Comment Utility
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
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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
 

Author Comment

by:red_75116
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now