Removing defualt borders from links in Firefox (CSS)

Date: 14th January 2008 at 6:13 pm | Filed under: development, scripts | Author: Sam Burdge

One of Firefox's default styles is to put a dotted line border around active links. For many sites this is not an issue, and can even be helpful to the user, making it clear when they have clicked on a link. However, with some sites, especially when using images as links in the nav, it can look really ugly. To get rid of the dotted borders use the following CSS:

a:active, a:focus {outline: 0;}

7 Responses to “Removing defualt borders from links in Firefox (CSS)”

  • Comment by Matt Algren
    Date: February 22nd, 2008 at 3:40 pm

    Thanks for the tip. That's been a peeve of mine for some time!

  • Comment by Keshav
    Date: August 28th, 2008 at 11:42 am

    Thanks! That worked like a breeze :)

  • Comment by css
    Date: November 12th, 2008 at 3:28 pm

    Cascading Style Sheets (CSS) web design lessons
    Css link Properties Attributes - examles

    http://css-lessons.ucoz.com/link-css-examples-1.htm
    http://css-lessons.ucoz.com/link-css-examples-2.htm

  • Comment by skyler
    Date: December 4th, 2008 at 5:13 pm

    where do you plug that code into? i’m trying it on the css style and it’s not working

  • Comment by kushan
    Date: March 27th, 2009 at 3:40 am

    Thanx a lot!!

    M using Object tag but outline Rocks!!!!!

  • Comment by larry
    Date: June 24th, 2010 at 2:46 pm

    thanks! First search and found exactly what I was looking for!

    @skyler
    where you’d put all your link attribute styles is where that code will go.
    ie. a:link {}
    a:visited {}
    a:hover {}
    a:link, a:focus { outline: none;}

    this sits wherever you logically decide to put the code. Stick it with the rest of your tag selectors.

  • Comment by nj
    Date: February 4th, 2011 at 4:07 pm

    thanks very much for the tip!!

Leave a Comment

wordpress post navigation hacks

Date: 24th October 2007 at 2:34 pm | Filed under: development, scripts, wordpress | Author: Sam Burdge

This article covers using the global parameter $paged and the query $wp_query->max_num_pages; to create custom navigation links for previous and next posts. For some reason wordpress treats posts in the past as "next" and posts in the future as "previous" as explained in this exerpt from the WordPress website:
Read on…

5 Responses to “wordpress post navigation hacks”

  • Comment by gus
    Date: October 30th, 2008 at 1:18 pm

    Thanks for this interesting technique. I finally realized, though, that this works only for “paged” templates, like the index and categories and tag pages. Can you suggest a technique to use on single-post templates?

    I understand that some of this functionality is built in to the next_post_link and previous_post_link tags already, but it is still difficult to make one of them go away if you are using them with nested divs or other complicated bits of CSS — because you don’t have direct access to the anchor tag. Any suggestions for crafting an equivalent “if” statement that will make the previous or next link not show when not needed on a single-post page?

    Also, how much of a performance hit will the $wp_query call cause in the above code?

  • Comment by Sam Burdge
    Date: October 30th, 2008 at 11:34 pm

    Hi Gus

    With the next_post_link / previous_post_link functions you should use the ‘format’ parameter to keep your divs from displaying when the link is not needed. For example:


    <div id="post_nav">
    < ?php next_post_link('%link', 'Next Post'); ?>
    </div>

    will still display the div. While:


    < ?php
    $post_link_format='<div id="post_nav">%link</div>’;
    next_post_link($post_link_format, ‘Next Post’); ?>

    would only show the div when the link is needed.

  • Comment by Philip Arthur Moore
    Date: December 1st, 2008 at 12:17 pm

    Excellent writeup. Another suggestion: if you’re looking for a quick way to fade out elements that are disabled, consider adding a class to your disabled links (i.e. “.disabled”) and then controlling the functionality with jQuery (i.e. jQuery(”a.disabled”).fadeTo(”fast”, .2).removeAttr(”href”);). Thanks a ton.

  • Comment by Rumait
    Date: August 5th, 2009 at 1:51 pm

    where these changes will be made, i mean in which file, cofig.php or single post.php etc

  • Comment by sagive
    Date: August 28th, 2010 at 10:07 am

    do you have a solution that shows page number
    offering a direct navigation to the fifth, sixth page?

Leave a Comment