CSS - How To Work With A:link
Hi,
I'm new to CSS. I'm currently reading McFarland's "The Missing Manual," and I'm about 1/4 through. But it seems that no matter how hard I try to understand this problem, I can't get it. I'm trying to figure out how to set my heading links to look one way and all other links on the page to keep from inheriting the layout for those heading links. Here are the styles I'm using: a:link, a:visited { color:#5f4731; border:none; } .contentpagetitle a:link, a:visited, a:hover, a:active { color: #00477d; font-size: 150%; border-bottom: 1px solid #f4f4f4; font-weight: bold; text-transform: none; font-family: "Palatino Linotype", Georgia, "Times New Roman", Times; padding-bottom: 3px; text-decoration: none; } Here is a little piece of test html I'm using until I can figure this out: Code: <body> <!-- This is the heading link --> <a class="contentpagetitle" href="http://www.midsouthcc.org" target="_blank">Test Article</a> <!-- This is a paragraph that follows the heading link --> <p>Lorem ipsum cum ut viris gubergren conceptam.<a href="http://adinasnotes.blogspot.com" target="_blank">Adina's Notes</a>. Ferri electram at ius.</p> </body> Can someone tell me why the second link inherits the settings for the first link which is set to class=contentpagetitle? I'm missing something and I'm sure it's a simple answer, but your help would be greatly appreciated. Thanks, gsw Similar TutorialsHello everone, i just joined today in this community and looking forward to enjoying here for a quite long time as i want to develop myself with css. I have a horizontal menu which is based on an image that has three layers: unvisited link, hover link, active link. but somehow i cant get my active links to work and cant understand where im making a mistake. you can find php and css codes below. and i appreciate any single comments suggestions. PHP code: Code: <?php $block = ( is_front_page() ? 'h1' : 'div' ); // arguments for wp_list_pages $list_args = k2_get_page_list_args(); // this function is pluggable ?> <?php echo "<$block class='blog-title'>"; ?> <a href="<?php echo get_option('home'); ?>/" accesskey="1"><?php bloginfo('name'); ?></a> <?php echo "</$block>"; ?> <p class="description"><?php bloginfo('description'); ?> <ul id="menu"> <li id="home"><a href=""<?php if(is_home() || is_single() || is_category() || is_tag() || is_author() || is_year() || is_month()) { echo ' class="active"'; }?>>home</a></li> <li id="archives"><a href="?page_id=2"<?php if(is_page('archives')) echo ' class="active"'; ?>>archives</a></li> <li id="news"><a href="?page_id=35"<?php if(is_page('news')) echo ' class="active"'; ?>>news</a></li> <li id="contact" class="last<?php if(is_page('contact')) echo ' active"'; ?>"><a href="?page_id=31">contact</a></li> CSS code: Code: #menu { list-style: none; padding: 0; margin: -105px 25px; width: 332px; height: 30px; background: url('images/menu.gif'); position: relative; } ul#menu li { width: 80px; height: 30px; padding: 0 4px 0 0; text-indent: -900px; float: left; } ul#menu li.last { padding: 0; } ul#menu li a, ul#menu li a:visited, ul#menu li a:hover { display: block; width: 80px; height: 30px; background: transparent url('images/menu.gif') no-repeat; outline: none; } ul#menu li#home a, ul#menu li#home a:visited { background-position: 0 0; } ul#menu li#archives a, ul#menu li#archives a:visited { background-position: -84px 0; } ul#menu li#news a, ul#menu li#news a:visited { background-position: -168px 0; } ul#menu li#contact a, ul#menu li#contact a:visited { background-position: -252px 0; } ul#menu li#home a:hover { background-position: 0 -30px; } ul#menu li#archives a:hover { background-position: -84px -30px; } ul#menu li#news a:hover { background-position: -168px -30px; } ul#menu li#contact a:hover { background-position: -252px -30px; } .home ul#menu li#home a, .home ul#menu li#home a:visited, .home ul#menu li#home a:hover { background-position: 0 -60px; cursor: default; } .archives ul#menu li#archives a, .archives ul#menu li#archives a:visited, .archives ul#menu li#archives a:hover { background-position: -84px -60px; cursor: default; } .news ul#menu li#news a, .news ul#menu li#news a:visited, .news ul#menu li#news a:hover { background-position: -168px -60px; cursor: default; } .contact ul#menu li#contact a, .contact ul#menu li#contact a:visited, .contact ul#menu li#contact a:hover { background-position: -252px -60px; cursor: default; } i think the problem may be with the last 4 lines of CSS code because they are related to the active links but dont know how i can find out the problem. thank you for any single suggestions and comments. Hi, I need some links to have a specific color. a.ClassName:link works in FF but not in IE. Is there are work-around? PHP Code: .chatlistmale, .chatlistfemale, .chatlistcouple { display: block; border: solid; border-width: 1px; width: 200px; } a.chatlistmale:link { background: #006699; } a.chatlistmale:active { background: #006699; } a.chatlistmale:visited { background: #006699; } a.chatlistmale:hover { font-weight: bold; } a.chatlistfemale:link { background: #FF0033; } a.chatlistfemale:active { background: #FF0033; } a.chatlistfemale:visited { background: #FF0033; } a.chatlistfemale:hover { font-weight: bold; } a.chatlistcouple:link { background: #00FF00; } a.chatlistcouple:active { background: #00FF00; } a.chatlistcouple:visited { background: #00FF00; } a.chatlistcouple:hover { font-weight: bold; } Hey guys, When i apply a stylesheet to this page. http://jessup.oraclestudio.com.au/i...p?page=coporate the link on the left hand side 'Forensic Accounting' doesnt appear to work in IE but work fine with no style sheet. By not work i mean it gets styled but doesnt function as a link. any ideas ??? Code: a:link { color: #333333; font-size: 11px; } a:hover { color: #333333; font-size: 11px; } a:visited { color: #333333; font-size: 11px; } Hey all, So i have two files my html file: Code: <html> <head> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body> <a href="#">this is a test</a> </body> </html> And my css file: Code: a:link {color:#000000;text-decoration:none;} a:visited {color:#000000;text-decoration:none;} a:hover {color:#CC0000;text-decoration:underline;} a:active {color:#000000;text-decoration:none;} except that the styles don't work on the links. If i put the styles in <style> tags in the html head it works, but in a seperate file they don't, can someone help me? thanks! - legit Edit, whoops sorry, I had the wrong name for my css file PROBLEM: I create a nice button using the sliding doors technique for rounded corners. But the button displays with 100% width unless I float it. My layout requires that the buttons be inline with the text, so floating won't work. Anyone know an alternative? I wouldn't mind floating but I want the button to show inline with the text. When I use float:left, it removes it from the inline flow. Basically, I want a very modular button that can be used in several different places on a page. In many cases, floating is fine because the mockup has it out of the inline text, but I want to use it there, too. Here's the HTML: <a class="button" href="#"><span>Update Profile</span></a> Here's the css: a.button:link, a.button:visited { background:url(button_right.gif) no-repeat right top; } a.button span:hover, a.button span:active { background:url(button_left_hover.gif) no-repeat right top; } a.button span { background:url(button_left.gif) no-repeat left top; color:#fff; cursorointer; display:block; height:20px; line-height:20px; margin:0 2px 0 0; padding:0 10px; position:relative; white-space:nowrap; } http://tinyurl.com/5llwfl I'm having some problems with this page in particular. Try clicking on one of the Left or Right white image arrows below the main picture. This only occurs in Firefox 2.x. Once you click the link, the content area below "Starting from $278.497" should shift roughly 5 pixels down. I thought it may be related to the dotted link outline that surrounds the image, but that was not the case. I applied styles to get rid of that and there was no changes. I also thought it may be related to a position:relative; bug which this site has been notorious for. I tried making certain divs in that area position:relative to no avail. So to test further I tried an overall #content *{position:relative;} fix which could not fix the position shift, either. I'm not sure what else it could be. And while I do have access to the build of this app, I have not been able to reproduce the issue by downloading all HTML, CSS, and image files locally. Hello Is there a way i can restore my <a href> link back to its original color, that is before the a:visited event, when I click on another link? PS. no Javascript code needed, is their an alternative in css? I'm going mad with this, I tested the CSS a:hover function over FF 1.0.7 and IE6, and the style file is simple: PHP Code: h3 { margin:10px; color:#636500; font-family: Arial, Helvetica, sans-serif; font-style: normal; } p { margin:10px; color:#636500; font-family: Arial, Helvetica, sans-serif; font-style: normal; } a { text-decoration: none; } a:hover { color:#636500; } a:visited { color:#cecf9c; } a:link { color:#cecf9c; } searched through the forum but seems nobody has got this problem... I just want the link to change color, I imported the css file to my html and it worked for the first time. I clicked on the link and then use brower's "Back" button to test it again, but the hover feature is not working anymore. I think it may be affected by the a:visited style, but how do I make a:hover work all the time? Thanks for helping. I have my links defined with a dashed border, but I don't want this on linked images and I'm trying to figure out if I can accomplish this with CSS only without additional markup in my HTML file. Here is a sample file: http://www. shawkey.com/test/imagebordertest.html Any suggestions on how I can get the dashed border to not appear below the image and only appear below the text with just CSS? Hello is there a way to make it so hyperlinks are not decorated as the default blue? I have the following css which I've attempted to make it so the text '.com' is always white, but it defaults to the standard link color. html: <td class="nodecoration"><a class="nodecoration" href="http://www.somesite.com">.com</a></td> css: Code: td.nodecoration { background-color: #003399; color: white; width: 120px; height: 30px; font-family: "Verdana", sans-serif; font-size: 25px; font-weight: bold; text-align:center; } A:link.nodecoration {text-decoration: none} A:visited.nodecoration{text-decoration:none} A:active.nodecoration{text-decoration:none} a:hover.nodecoration{text-decoration:underline} Im not good at all with CSS and need some help getting this to work in IE8 or older/newer versions. Works great in Firefox though. <div style="width:90%;height:150px;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:4px solid #F4F4F4;background-color:#FFFFFF;-webkit-box-shadow: #B3B3B3 15px 15px 15px;-moz-box-shadow: #B3B3B3 15px 15px 15px; box-shadow: #B3B3B3 15px 15px 15px; padding-top:2%; padding-left:2%;"> Any help making this work in IE8 would be great. Well my fiance and I are starting a website for our photography and I designed what I wanted the layout to look like using Adobe Photoshop however now it's become a headache to get it to work. i18.photobucket.com/albums/b117/Nagoshiffxi/help.jpg this is what we want it to look like pretty much centered on a black background, each of those navigation images being individual pictures... the background being the box with the 3 images floating over it... At the moment I have part of it working he www. pollard-exposures.com/v1/ If someone can view the source and tell me a better way to make it work and how I may be able to add in the individual navigation pictures along the left side like I have it in the picture I would really really appreciate it... I am not sure how to even begin... Hi Guys, I have a pretty specific page here, work fantastically in Firefox, but not in IE6/7 (or Safari/Opera etc ). Any ideas?! Thanks! (URL address blocked: See forum rules) Darren. hi, it seems like my external css is not working... Code: <link href="print.css" rel="stylesheet" type="text/css"> if i convert it to a internal one, it working fine.... i'm using a ie browser .... so if you know what is the problem or how to slove this problem, please reply me... Thanks alot.... Hi all Another stupid annoyance relating Internet Explorer: it seems IE6 does not recognize the following CSS selector rule: tag#id.class e.g. div#content.active One has to split it into div#content .active Is that right? Do we just have to live with this? Greetings, Josh On this page (FAQs.html) I'm using css Code: Original - css Code *:target {background-color: #ffff00;} *:target {background-color: #ffff00;} to get the yellow highlight on the corresponding Q/A when you click a question. Works great in FF2, Opera, Chrome, Seamonkey, and Safari. But of course IE7 has to be a problem. It doesn't work in IE7. (Don't know about IE6, don't have that to test it on.) I've been Googling for a way to implement this effect in IE but haven't found anything. Any ideas? Thanks, Ez P.S - the text on the FAQs page is just dummy-text until i get the real content to insert. Hi, there. I've created a simple tableless 3-column fixed-width layout within a 'wrapper' div#. The column displays exactly how I want it and where I want it in Firefox, Safari, Chrome... but not in IE7 - for some reason, IE7 repeats part of the content of the third column. courses.algarve-golf.co.uk/index.html courses.algarve-golf.co.uk/scripts/default.css (The site isn't yet finished, so while the CSS validates, the HTML is not completely validated as I have more content, nav-bars and so on to add.) I've double and triple-checked everything I know of, but as my CSS experience is somewhat limited, I'm hopeful that this is just the result of a known IE7 that i'm not yet aware of. Any help or advice that anyone can offer greatfully appreciated! I'm an amateur web designer, I only do pages for my band and for the gallery I work for. What happens is that on a Mac, people only get the background. www.formone.net is my band's site. www.kennedygallery.org is the gallery. www.kennedygallery.org/icefollies is a mini-site I made for an off-site event we did. I'm not sure whether it's IEmac or Safari or what that craps out, but the director of the gallery uses a mac and so I'd really like it if he could see our site. haha. Hi all, I am using <tr class="caption"> in order to control the properites of a line in a table. The problem is: this will not work. Nothing that is written in this CSS tag will work my CSS tag: Code: tr.caption { font-weight: bold; font-size: 14px; text-decoration: none; background-color: #000000; color: #FFFFFF; } any idea why?? I am greateful for any answer! Dekers |