CSS - Color Changes Of Links Within Stylesheet Sections?
Hi Guys!
Most of the links in my document are set to #ffffff, because they have a dark background. I have 'content' section that I want to show blue links. I tried adding the following code into my style sheet: PHP Code: a.content:link { color: #0000FF; text-decoration: underline; } a.content:visited { color: #0000FF; text-decoration: underline; } a.content:hover { background-color: #6666FF; text-decoration: underline; } And nothing!? (apart from the layout crapped up!!!!) Could someone point me in a better direction? Full CSS below! Thanks Charlie PHP Code: html {height:100%;} body { margin:0; padding:0; height:100%; background-image:url(images/newback.jpg); background-position:top right; background-repeat:repeat-y; background-color:#ffffff; font-family: sans-serif; font-size: .7em; } #wrap { background-image:url(images/newback150px.jpg); background-position:top left; background-repeat:repeat-y; min-height:100%; } * html #wrap {height:100%} div#navbar {padding: 0%; text-align: center; background-image:url(images/newback.jpg); background-repeat: repeat; background-color: #000044; color: #ffffff; margin-bottom: 0px; border-bottom: solid #000000 1px} div#formbox { color: #000000; padding: 2%; border: #000044 solid 1px; } div#userbar {padding: 0%; text-align: center; background-image:url(images/newback.jpg); background-repeat: repeat; background-color: #000044; color: #ffffff; margin-bottom: 0px; border-bottom: solid #000000 1px} #header { background-color: #000044; background-image:url(images/wel.jpg); width 100%; background-repeat: repeat; border-bottom: 2px #000000 solid; color: #ffffff; margin:0; padding:0; height:100px; } } #left { float:left; width:149px; background-image:url(images/newback.jpg); background-repeat: repeat; color: #ffffff; text-align:center; background-color: #000044; border-right: 1px #000000 solid; } #main { position:relative; margin-left:200px; } #content { text-align:center; padding:4px; margin-right:200px; margin-bottom:150px; text-align:left; } #clearfooter { clear:both; height:80px; overflow:hidden; } #footer { height:40px; background-color: #000044; border-top: 2px #000000 solid; margin:0; padding:0; background-image:url(images/newback.jpg); background-repeat: repeat; margin-top:-0px; color: #ffffff; text-align:center; } div#newsbar {padding: 0%; text-align: center; height:140px; background-image:url(images/newback.jpg); background-repeat: repeat; background-color: #000044; color: #ffffff; margin-left: +150px; margin-right: +10px; margin-top: -180px; border: 2px #000000 solid; width: auto;} code { font-size:0.8em; border:1px solid navy; background-color:white; color:#333333; padding:10px; display:block; width:80%; margin:10px auto; overflow:auto; } h1 {font-size: 1.4em; font-family: Times, "Times New Roman", serif; font-weight: bold; text-align: left;} h2 {font-size: 1.3em; font-family: Times, "Times New Roman", serif; font-weight: bold; text-align: left;} h3 {font-size: 1.2em; font-family: Times, "Times New Roman", serif; font-weight: bold; text-align: left;} h4 {font-size: 1.1em; font-family: Times, "Times New Roman", serif; font-weight: bold; text-align: left;} h5 {font-size: 1em; font-family: Times, "Times New Roman", serif; font-weight: bold; text-align: left;} a:link {color: #ffffff; text-decoration: underline;} a:visited { color: #ffffff; text-decoration: underline;} a:hover {color: #dedbcb; background-color: #0000FF; text-decoration: underline;} Similar TutorialsHello, I can't seem to figure out how to make my CSS drop down menu work the way I want it to. I am using an id in the body tag and a class in the navigatin links so the style sheet will mark what section of the site you are in by making the background change color. This works. The problem is, now that I have the sections being marked, the highlight no longer works. How can I get the highlight to work in the section you are in? I have been experimenting for hours but I can't make it work. http://www.tpxdesign.com/test/Valliant/alpha/index7.php My nav menu code and nav style sheet: Code: <!--[if !IE]><!-- start nav --><![endif]--> <div id="side_nav_bar" class="floater"> <div id="nav_menu"> <ul id="nav"> <li><a href="demoreel.php" class="port">Portfolio</a> <ul> <li><a href="demoreel.php" class="port">Demo Reel/s</a></li> <li><a href="shorts.php" class="port">Shorts</a></li> <li><a href="musicvid.php" class="port">Music Video</a></li> <li><a href="comvid.php" class="port">Commercial</a></li> <li><a href="miscvid.php" class="port">Misc. Video/Film</a></li> <li><a href="gallery.php" class="port">Photo. Gallery</a></li> </ul> </li> <li><a href="services.php" class="serv">Services</a> </li> <li><a href="newupdate.php" class="newe">News & Events</a> <ul> <li><a href="newupdate.php" class="newe">News/Updates</a></li> <li><a href="eventblog.php" class="newe">Event Calendar</a></li> </ul> </li> <li><a href="bio.php" class="about">About Valliant</a> <ul> <li><a href="resume.php" class="about">Resume</a></li> <li><a href="bio.php" class="about">Biography</a></li> <li><a href="contact.php" class="about">Contact</a></li> </ul> </li> <li><a href="links.php" class="link">Links</a></li> <li><a href="index7.php" class="home">Home</a></li> </ul> </div> </div> <!--[if !IE]><!-- end nav --><![endif]--> Code: ul { margin: 0; padding: 0; list-style: none; width: 199px; /* Width of Menu Items */ border-bottom: 1px solid #ccc; } ul li { position: relative; } li ul { position: absolute; left: 198px; /* Set 1px less than menu width */ top: 0; display: none; } /* Styles for Menu Items */ ul li a { display: block; text-decoration: none; color: #777; background: #fff; /* IE6 Bug */ padding: 5px; border: 1px solid #ccc; border-bottom: 0; } /* Fix IE. Hide from IE Mac \*/ * html ul li { float: left; height: 1%; } * html ul li a { height: 1%; } /* End */ ul li a:hover { color: #E2144A; background: #f9f9f9; } /* Hover Styles */ li ul li a { padding: 2px 5px; } /* Sub Menu Styles */ li:hover ul, li.over ul { display: block; } /* The magic */ #home .home, #about .about, #link .link, #newe .newe, #serv .serv, #port .port { color: #000; background-color: #eee; } Quote: Dan Cederholm of SimpleBits: It's important to note that the cascading effect of CSS still applies, and alternate style sheets work just like any other style sheet, in that only common rules are overridden when the alternate styles are active. So if we had layout, positioning, and other site-wide rules in default.css that weren't repeated in the alternate style sheets, those default rules would still work. I'm making a site that has a default stylesheet with a fixed layout and an alternative one with a fluid layout. The problem I'm having is the alternative sheet not inheriting css from the default stylesheet even though the rules are not overridden. At the moment, my alternative stylesheet is an exact copy of the original (everything included) with only 3 width values changed to percentages. Theoretically, I should be able to only include these three rules alone in the alt sheet, as rules are carried over from the default sheet unless overridden. However, when I do try to reduce the alt sheet to just: Code: #container { width: auto; } #main { width: 65%; } #navbar { width: 30%; } all unincluded formatting is lost. Am I doing something wrong? Cheers, Sam. Hi, I have a simple table <table id="sometable"> <tr> <td> <a href="link1">link1</a> <td> <a href="link2">link2</a> </table> with a style sheet table#sometable {width: 100%;} table#sometable a:hover{background-color: #A9A9A9;} What I want is on a hover the whole cell changes color, not just the link. How can I do this? Also should I be using a table in the first place? Thanks Colin Does anyone know if/how I can get a CSS script for link classes that would only change the colour of the underline like the one at the top of Altavista's translate page?? I have tried viewing the source but can't seem to put my finger on it. Any help would be greatly appreciated. Cheerz, sheermonkey. I have a very strange problem. My firefox is ignoring the changes I made to the style sheet. I have this in my webpage and the style.css file location is right (one directory up). <link href="../style.css" rel="stylesheet" type="text/css"> Because it's ignoring my new changes, I deleted everything in my style.css file, and the page still displays as though the file exists. However, if I delete the above line, then the page will display without any style. IE is loading with the changes I made though. I have also checked my stylesheet with the W3C css validation and it has no error. So, any body know why this is happening? Hi all, I am having difficulty with the background for an image link. I have the following: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Test page</title> <style type="text/css"> a:hover { color: #FFFFFF; background: #0000ff; text-decoration: none; } a:hover img { background: none; } .box { background: #00ff00; padding: 1em; } .box img { border: 0; } </style> </head> <body> <div class="box"> <p><a href="#"><img src="images/a1a8aa6a43.jpg" alt="" /></a></p> <p><a href="#">Text link</a></p> </div> </body> </html> I have a global style for links that change the background color and the color of the text. However, this also changes the background color of an image link which makes it look odd. I attempted to fix this with Code: a:hover img { background: none; } But this does not fix the issue. Any thoughts? I am using XHTML strict because the CMS I am using forces me to an XHTML stylesheet. Also, this is just a snippet of the code of the actual page but the bug is present in this snippet. I've got two questions of which one is to gather some opinions to help me decide what's best. 1) color notation in CSS: Any recommendations as to what notation I should use? examples: color: rgb(255,234,0) color: slateblue color: #FF99CC color: #F9C Is there some recommendation here? I'm quite used to the long hex notation e.g. #FF99CC. Is the short notation also very much accepted? And should I be using those at all or should I prepare myself with a new site to switch to rgb(). 2) text-decoration yes or no? I was thinking the following: A) when it's absolutely clear that some text presents a link, like e.g. in a menu or some newscolumn with a brief description and a bold title, then it's "okay" to set text-decoration: none. Maybe an underline or colorchange when hovering. B) When it's not absolutely clear what's a link, like some word in a paragraph text, use underline or at least some other colour which is consistent over the website for being a link. Also, with point B I was thinking of choosing: A new link: text-decoration with color and text-decoration gone with hover, for a nice effect. With a visited link: I) text-decoration but normal paragraph color and again text-decoration gone when hovering OR... II) no text-decoration, but still with that color and text-decoration when hovering. It troubles me coz I can't make up my mind. Something keeps telling me that I should try to keep those text-decorations like with B-I and simply remove the colour, instead of relying on colour to indicate a link. So forget about B-II?! Ah, it was this site which works on my conscious not to rely on color for links: http://lists.w3.org/Archives/Public/www-style/2003Mar/att-0002/01-part#colorunits Anybody got some comments or tips? And yes also some tip on the CSS I want things to be "user-friendly" enough, but this also means that I don't want text to be broken up too much. Some people even suggested that I should take ALL links out of the paragraph and simply mention them below the paragraph. All good points, but which way to go Is there a way to tell the browser not to change the color of a visited link? I have an anchor around some text, but I don't know the color setting of the text. When I visit the link, I just want the text to retain its color based on the other CSS declarations in effect for the text. So, is there a way to specify a:visited { color: do-not-change; }? Hey i got some cells in a table which hold links. How can i make only the links inside these cells a different color? This is the class i use on the table cells: css Code: Original - css Code .selectedContactRow{ background-color: white; color: black; }
I only know how to change the link colors in general. css Code: Original - css Code a:link{color: red;} a:hover{color: red;} etc.
thanks in advance. Hi... I am not a coder, Im new at this. Im not even really sure how to explain my problem either, so bear with me, please. I am working on a theme for a site that allows you to edit the css style applied to the page, like myspace.com. Unfortunately there are limitations to this, like how many section IDs there are and such. In order to make a custom page, I am using ordered lists in BBcode. In forefox, I was able to move the ordered lists outside of their section by using positioning, but unfortunately in IE, it would not allow this. Basically the lists would be hidden/invisible outside of the section element parameters. So, again in order to work around this, I made the section the ordered lists were in cover the entire page. Firefox handled this fine, and the elements on the page worked together so long as text was not right on top of links etc. IE, no such luck. The links in another section do not activate even though they are not visually overlapping. This creates a problem for me, as I will now need to make another ordered list to create links which will activate. Is there a way I can get around this? Because I have a section which covers the entire page in IE, and overlaps onto other sections, I'm looking for code which will allow the sections in IE to overlap without causing one section or the other to behave incorectly. Anyway, here is the link to my page so you can see what I mean. The links in question are the little glowy circles. They work in firefox, but they only appear in IE and will not act as links. Any help would be appreciated. I dont mind re-doing the code and the lists in order to avoid adding more code to create links which work. http://www.gaiaonline.com/profile/index.php?view=profile.ShowProfile&item=305091 Thanks Kim Hello, I'm still playing around with CSS and I put together this test, to see if I could create tabs on a page.... Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test Site</title> <style type="text/css"> /* ----- ALL ----- */ * { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; } /* ----- TABS ----- */ #tabs { float:left; } #tabs, #tabs ul, #tabs li { margin:0; padding:0; list-style:none; } #tabs a { background-color:#AE5700; color:#FFFFFF; margin-left:1px; margin-right:1px; margin-bottom:1px; padding:5px 5px 5px 5px; text-decoration:none; cursor:pointer; float: left; } #tabs a:hover { color:#000000; background-color:#FFCC99; } #tabs .active a { color:#000000; background-color:#FF9900; padding-bottom: 1px; margin-bottom:0; } /* ----- SECTIONS ----- */ #section1 { background-color:#FF9933; padding: 20px 20px 20px 20px; } </style> </head> <body> <div id="tabs"> <ul> <li class="active"><a href="#">Option 1</a></li> <li><a href="#">Option 2</a></li> <li><a href="#">Option 3</a></li> </ul> </div> <br /> <!-- If I remove this, the section overlaps the tabs! --> <div id="section1"> Hello </div> </body> </html> I know I know, it's very basic! The problems im trying to figure out are as follows.... 1. This code displayed in Firefox, works as i'd expect. But under the dreaded IE, it displays the tabs diagonally down the page. I know that IE doesn't work as it should, but how do I get the tabs to look the same in IE as they do in Firefox (ie... display them correctly!) 2. The tabs are meant to sit right on top of the section of orange. Using the BR tag (commented in script), I can get it to move down a little bit - but how do I achieve positioning the section box right underneath the tabs using CSS? All help is appreciated! JT p.s. Attached a screenie of the browser output for reference! Hi, my css drop down menu seems to be working fine in firefox, but there are a few problems in IE. It didn't even work in IE7 until I added Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 1. In IE7, if you first hover over the link to get the drop down menu to show, move away, then hover over the menu again, it will show the blank sub menus of the one you last have opened. This is hard to explain. Please see my webpage for what I mean. http://ling.twinner.com.tw/uselink/index.php Move your mouse to the Products link at the top. 2. My menu seems to load slow. Is it because I have many sub menus or is my css not efficient? 3. How do I set the sub menu height to auto? Here is my css: http://ling.twinner.com.tw/uselink/menu_style.css Any suggestion is greatly appreciated. Hi all, I have a 2-column layout for my web pages plus a header and footer section. The left column contains a navigation menu (which grows and shrinks depending on the current menu selection), and the right column contains the main text and other information. I float the nav menu left. No problem. But when the footer is displayed (and I have set "clear: both" on the footer element to try and keep it at the bottom), it will appear somewhere in the middle of the menu in cases where the menu is long (vertically) and the main content area contains only a few lines of text. My current method to drop the footer below the menu is very klunky, and probably what most people do (unless they know of a better way). Yes, the series of <br /> tags before printing the footer. Is there a better way of ensuring that the footer is placed where it should (below all other content) so I don't have to insert all those <br /> tags? My CSS for the page layout is: Code: #doc { /* Main document area */ margin-left: 5%; margin-right: 5%; margin-top: 5px; border: solid 1px #900; } #logo { text-align: center; background: #c30000; } #main { margin-left: 150px; margin-right: 0%; padding: 10px; border-left: solid 1px #c00; background: #fff; color: #000; } #nav { position: absolute; margin-left: 0%; float: left; padding: 0px; border: 0px; top: 110px; width: 150px; /* Same as margin-left setting in #main */ color: #000; } #footer { clear: both; margin-left: 0%; margin-right: 0%; border-bottom: 2px solid #906; background-color: #c00; color: #ddd; font-weight: bold; text-align: center; line-height: 1.5; } And a typical html page would be structured thusly: Code: <!-- USUAL HTML BEGINNING STUFF HERE --> <body> <div id="doc"> <!-- Logo image --> <div id="logo"> <!-- LOGO GOES HERE --> </div> <!-- Main content window --> <div id="main"> <!-- MAIN CONTENT GOES HERE --> </div> <!-- Navigation menu --> <div id="nav"> <!-- NAV MENU CODE HERE --> </div> <!-- footer --> <div id="footer"> <!-- FOOTER CODE HERE --> </div> </div> </body></html> Is my CSS coding incorrect, or is this a universal problem? Any help/suggestions will be much appreciated. i have just finished making a site for a collective of illustrators I belong to, and now I'm hearing back that some people are having trouble with it. It's at www.illustratorselbow.com (I'm not allowed to post a url without spaces!) & i'm hoping people might be able to have a look at it & view the source and help me out. If you click on somebody's name, you see the thumbnails on the right and the image on the left. When you compress the window, the thumbnails jump about and shrink. I want to make it so this can't happen- I'd rather that the section with the main image in it compressed a bit, or would side-scroll. Any idea how to do this? I'm pretty new to CSS too so I don't really know how to fix this. It's just a drag because on computers with smaller screens/resolutions, the thumbnails look really messy. (Bear in mind that I have extremely basic knowledge of html/css/php, i hand code rather than use dreamweaver etc, and I've never used php or css before this site. I started using it because I keep hearing that frames are bad news nowadays, but it's been sooo much trouble with my limited abilities... alas) Here's the code:
Code: <html> <head> <title>Sample Font Shorthand</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> body { margin: 0; behavior: url("../htcmime.php?file=csshover2.htc") } div { } table { width: 100% } .sttable { background-color: #000080 } tr { } td { vertical-align: top } .sttd { font: bold 12px Arial #FFFFFF } </style> </head> <body> <table class="sttable"> <tr> <td class="sttd">Catalog > Categories</td> <td class="sttd">Cart Total: $ 0.00</td> <td class="sttd">Date</td> </tr> </table> </body> </html> Would someone please tell me why the color of the text isn't rendering white? I was wondering does anyone know where I can obtain the Internet Explorer 6 stylesheet for Windows XP? The UI components in IE6 look different in Windows XP than IE6 for Windows 2000. I would like to obtain the stylesheet if it is available somewhere. Thanks for your help. Val I have three different css Stylesheets. Now I want to give access to my users to change their required styles using dropdownlist. And next time when the user is login in the same last selected style sheet should be displayed to him. How can i do this please help me its urgent ? Hiya, theres a website I'm creating a print stylesheet for which includes the company logo in the header, with a footer of contact details. problem is, the website is all static pages and 100 odd pages, so as I'm having to deal with the static state of the site for now, is there a way I can have in the Print stylesheet or in the CSS where the logo can be inserted in a header and a footer created with text? hope this makes sense? I'm fairly new at web development and pretty much a newbie at using CSS. I noticed on foxnews.com that they use a parameter with the CSS file. I've did searches on this but not turned up alot. Code: <LINK REL=STYLESHEET TYPE="text/css" HREF="/css/mainStyles2004.css?v2"> <LINK REL=STYLESHEET TYPE="text/css" HREF="/css/rootStyles.css?v3"> I'm assuming the ?v2 and ?v3 are PHP like paramters. I looked at the CSS file using the firefox web developer toolbar and I didn't see any referance to v2 or v3 in those files? Can anyone explain this to me? Can you only exclude elements from a Print stylesheet? I'd like to print only a table of data and nothing else on the web page in a print style sheet. |