CSS - Override Link Colors From Css
I have a CSS that manages my site, but I've got a list of links that are dynamicly created with php/mysql. I have two lists that I would like to use non-CSS colors for their links.
Is there a way to override the CSS to force certain colors on the links? I've tried using the normal <p> or style settings, but the main links portion of the CSS always takes precedence and I can't seem to make it work for me. A little background for you...the lists are as follows: 1 - a list of currently open jobs in the company 2 - a list of all jobs in the company Both lists are also links to the job descriptions. List 1 is created based on whether the database has the job flagged as open, so its never static. List 2 is not static either because it lists the jobs in the database. Similar TutorialsHello all I need help please :-) I have a website I am making that will have various boxes and each box has to have a different link color and hover over color. My issue is that teh css does not work in terms of making all the links display the correct color as outlined in the css file. here is my css file maybe someone can tell me what is wrong (I will comment in the file also whats not working Code: <style type="text/css"> body { background-image: url(./images/pgbg.gif); color: #000000; /*the below link attributes does not work */ visited: color:#000000; text-decoration: none; link: color:#000000; text-decoration: none; focus: color:#000000; text-decoration: none; active: color:#000000; text-decoration: none; hover: color: #CC0000; } .header{ background-image: url(./images/header.png); background-color:#E6E6E6; position:absolute; width: 900px; height: 100px; left: 50px; top: 5px; } .navbox1{ /*General Links Navbox*/ background-image: url(./images/navbg.png); position:absolute; background-color:#E6E6E6; width: 170px; left: 60px; top: 115px; padding-left: 5px; /*the below link attributes does not work */ visited: color:#E6E6E6; text-decoration: none; link: color:#E6E6E6; text-decoration: none; focus: color:#E6E6E6; text-decoration: none; active: color:#E6E6E6; text-decoration: none; hover: color: #CC0000; } .navbox2{ /*Users Links Navbox*/ background-image: url(./images/navbg.png); position:absolute; background-color:#E6E6E6; width: 170px; left: 60px; top: 310px; padding-left: 5px; /*the below link attributes does not work */ visited: color:#E6E6E6; text-decoration: none; link: color:#E6E6E6; text-decoration: none; focus: color:#E6E6E6; text-decoration: none; active: color:#E6E6E6; text-decoration: none; hover: color: #CC0000; } .loginbox{ /*Login Box*/ background-image: url(./images/navbg.png); position:absolute; background-color:#E6E6E6; width: 170px; left: 60px; top: 400px; padding-left: 5px; } .content{ background-color:#E6E6E6; position:absolute; width: 700px; height: 455px; left: 250px; top: 115px; padding-left: 10px } .footer{ position:absolute; width: 700px; left: 100px; top: 585px; color: #D6E7D3; } </style> I'd like to be able to make some links on my page one color and others a different color so they show up appropriately on different backgrounds. how would i go about doing this? thanks Hi, Using CSS how can I set an individual bit of text to have a different link color then the rest of the links on my website? Thanks I'm making a page and I've got an a:link specification. I want a separate specification for a part of the page under a .header tag. The background on that part of the page doesn't match the a:link color I have specified for the rest of the page. So I want one specifically for the .header tag. Doesn't seem to be working though. How do you think I should throw it in there? I've set-up a few link colrs in a style sheet - I see it working in mac IE, and Safari - but not IE in windows. Most of the formatting is being ignored. I'm going to try setting all attributes (link, visited, hover...) for each set but that seems like a reach. any ideas? the link: http://www.eightbyten.com/rc_store/shopcart_test.html the style sheet directly: http://www.eightbyten.com/rc_store/link.css Thanks! Greetings all. I am building a site which displays data in tables, with different background colors and different text colors. I am using CSS for everything, and it's working out great. Very happy with it so far. What I want to do, and can't seem to figure out, is link / visited colors. In each line of data, some of the columns are links. I want to set the link text color to the same as the non-link text color. I can override the text color easily enough. If I want a row to be white on red, I do that by saying: <tr style="background-color: #f00; color: #fff" >. I cannot figure out how to change a link color. The cells in the row that are links, I want to make them white on red also. Not just the default link color for the page. Any help would, of course, be greatly appreciated. Thanks, Tom This is the new site I'm working on: http://animalemergencybloomington.com/Index2.html Link and Visited Link colors work, but I can't get Active or Hover color to work. (Doesn't work in any of the browsers I've tested it in.) Right now I have this in the <head> css Code: Original - css Code <style type="text/css"> body { color: #000000; font-size: 12pt; font-family: Verdana; margin: 0px 0px; } A:link { text-decoration: none } A:visited { text-decoration: none } </style> <style type="text/css"> and this for the <body>: <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" alink="#0000FF" vlink="#1E90FF"> adding a:active and a:hover colors to the style gives a "parse error" for those lines when I try to validate and doesn't work anyway as far as getting a color change on hover. I've been trying different combinations in the body and style all afternoon but get error warnings on everything I've tried except the above combo. I'm just trying for links that are never underlined (hate how cluttered that makes things look) but turn red on hoover. Help? Thanks, Ez I'm just starting to experiment with external css files and I'm stuck on how to deal with setting color for the links. When I put this in the html page itself it works fine: <style type="text/css"> a:link {color: #FF0000} a:visited {color: #00FF00} a:hover {color: #FF00FF} a:active {color: #0000FF} </style> But when I instead move it to the body section of my external css file and link to that css from my html file, it doesn't do anything (link colors just go back to the default). I know I'm generally setting up the external css file correctly since the other things I set in that external file get picked up correctly (font family, font size, background image, etc.). Any magic to using link colors in an external sheet?? In case it helps, here is my css file: Code: body { background-color: #000033; color: white; background-image:url(balbkgnd.gif); a:link {color: #FF0000} a:visited {color: #00FF00} a:hover {color: #FF00FF} a:active {color: #0000FF} } td { font-size: 12.0pt; font-family: Trebuchet MS; a:link {color: #FF0000} a:visited {color: #00FF00} a:hover {color: #FF00FF} a:active {color: #0000FF} } th { font-size: 12.0pt; font-family: Trebuchet MS; a:link {color: #FF0000} a:visited {color: #00FF00} a:hover {color: #FF00FF} a:active {color: #0000FF} } I've searched the forum but can't find why my test with the following code works properly in IE (white link goinf yellowish on mouse over but not in FF or Op. It would be useful to correct this before going any further: Many thanks Robert ______________________________ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="description" content="test" content="test"> <title>test</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8895-1" /> <link rel="stylesheet" href="testcss.css" TYPE="text/css"> </head> <body topmargin="0"> <div align="center"> <table border="1" cellspacing="1" width="760" bordercolor="#243348" height="50"> <span class="menu"> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item1.htm">item1</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item2.htm">item2</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item3.htm">item3</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item4.htm">item4</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item5.htm">item5</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item6.htm">item6</a></td> <td width="40" align="center" bgcolor="#243348" height="50"><a href="item7.htm">item7</font></a></td> <td width="41" align="center" bgcolor="#243348" height="50"> <p align="center"><a href="item8.htm">item8</font></a></td> </span></table> </div> </body> ______________________________ .menu a {text-decoration:none; font-family: arial; font-size: 10pt } .menu a:link {color:#FFFFFF; } .menu a:visited {.color:#FFE2A8; } .menu a:hover {color:#FFE2A8; } .menu a:active {.color:#FFE2A8; This code works in IE but not in FF. Does Firefox not support these? <style type="text/css"> <!-- A:link { text-decoration: underline; color:"#ffffff"; } A:visited { text-decoration: underline; color:"#ffffff"; } A:active { text-decoration: underline; color:"#ffffff"; } A:hover { text-decoration: none; color:"#fffffff"; } Body { background:url(http://n0madism.tripod.com/mbg.jpg); background-color:#000000; background-repeat: no-repeat; font-family:Georgia; color:#ffffff; font-size:10 pt; text-align:left; scrollbar-face-color : #000000; scrollbar-highlight-color : #000000; scrollbar-3dlight-color : #000000; scrollbar-shadow-color : #000000; scrollbar-darkshadow-color : #000000; scrollbar-track-color : #000000; scrollbar-arrow-color : #FFFFFF; } td { font-family:Georgia; color:#ffffff; font-size:10 pt; } --> </style> A quick question about how to over-ride style on the <a> tag: I have the following css: Code: #menu a { display:block; padding:8px 12px; background:#5a5152 url(images/seperator.gif) bottom right no-repeat; color:#ccc; text-decoration:none; } #menu a:hover { background:#2580a2 url(images/hover.gif) bottom center no-repeat; color:#fff; } I want to override this for the last menu item to get rid of the separator on the last menu item on the right - but want to keep everything else. I have tried the following which does what I want but I lose the hover effect: Code: <a style="clear:both; display:block; padding:8px 12px; background:#5a5152 bottom right no-repeat; color:#ccc; text-decoration:none;" href="contact.php" title="Contact Us">CONTACT US</a> How do I add in the hover to the above override or is there abetter way to do this? I'm new to CSS, and I've been working with Wordpress. While learning CSS, I'm experimenting with various things in HTML, Php, and Javascript. I'm often finding myself wanting to override the CSS settings implemented by Wordpress. However, I don't want the settings overridden for every page - just the particular one I'm working on. In other cases, I only want the CSS overridden for a few lines of code (such as font type). This kind of problem is making me think writing customized CSS/Php is worth exploring. I spend twenty minutes coding something to spend an hour trying to integrate it with Wordpress. Is there a way to get the style sheet to let the inner tag to override the parent's tag? Seem that only one webpage need that while many other doesn't. I'll post the code below, take a look at the text-align:left ...... Code: <div style="margin:0px;padding:25px 30px;text-align:left;"> <img style="text-align:center;" src="..."> </div> I have 2 css files. One main one that I am using Code: input[type="text"], select { background: #FFF !important; } I use that mainly for Firefox as without it the form fields are yellow. but I would like to override that have have one form field on this one page stick out and have it like this. Code: .CCfield { color: Black; background: #FFFF66; } Is this doable? How can I override it for this one field? Thanks Is there a way to get the style sheet to let the inner tag to override the parent's tag? Seem that only one webpage need that while many other doesn't. I'll post the code below, take a look at the text-align:left ...... Code: <div style="margin:0px;padding:25px 30px;text-align:left;"> <img style="text-align:center;" src="..."> </div> I have setup a style for the <A> Tag which will be used throughout the site. Code: a { cursor:pointer; color: #8E9300; text-decoration: underline; } I have one div on one of the pages that contains some links, on this one div I would like to redefine the <a> tag or override it but not affect the <a> tags on the rest of the site. How can I do this? Thanks. I have the following in my css: Code: input, textarea, select { font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #ECEEF1; border: 1px solid #505355; color: #505355; margin: 3px; font-size: 10px; } input:hover, textarea:hover, select:hover { background-color: #FFE7DB; border: 1px solid #D64800; color: #D64800; } and then I have something like this on my page: <input name="rate" type="radio" value=6 onclick="this.form.submit()" class="rateradio" /> How can I make the class selector 'rateradio' to override the background-color and border options in the input and input:hover css? I have some inputs wich I want that css to work but some inputs I want to override the background color and the border, how can I do it? I made a few tables using the old HTML method o setting table attributes. However I later discovered css for tables and wrote the following and it works well with some new tables i have made: Code: table { border-collapse: collapse; border-spacing: 0px; } Now all my old tables follow the above style (quite naturally). How can I override the css styles for the older tables? how do i set border-spacing to its default value? thanks Hi can anyone tell me if I can override embedded CSS with a linked stylesheet? Here is what I want to change: Code: <col width="40%" style="background-color:#EEEEEE;text-align:left;"> I want to change the background-color without changing anything in the above mentioned code, this means I want to change it with an extern stylesheet. Is there a way to override CSS padding to use cellpadding instead or can inheritance be prevented? I have a CMS and I want editors to still be able to use the cellpadding attribute rather than make a class for each desired padding. I am not able to set a defining ID or class on the table as it's generated with our CMS. The relevant tables are contained in a defined parent class. Code: TD{ padding: 0px; } .custom TD{ /*padding: ignore;*/ } Code: <span class="custom"> <table cellpadding="5"> ... </table> <span> |