Treehouse: Grow your CSS skills. Land your dream job.

Remove the last border right?

  • # April 30, 2013 at 9:10 am

    I have set on my nav li a a border right how would I remove the very last border?

    # April 30, 2013 at 9:14 am

    Use last:child

    # April 30, 2013 at 9:39 am

    Perhaps you should use `:first-child` and change `border-right` to `border-left`. – This will add IE7 and 8 support.

    # April 30, 2013 at 9:40 am

    some thing like this #rightNav li a: last child {border-right: none

    # April 30, 2013 at 9:44 am

    I did this #rightNav li a:last-child { border-right: 0px; } removed all

    # April 30, 2013 at 9:46 am

    Didn’t know about that @jamy_za, I use :last-child quite often… In the event you are doing a border-left and a border-right (one light one dark effect) and you didn’t want to use :last-child for the above reason you could manually give the last one a class of last and style that with border-right: 0px; too.

    # April 30, 2013 at 9:47 am

    `border-right: none` should work.

    If not, try the solution given by @jamy_za

    # April 30, 2013 at 9:47 am

    Here is code pen sample

    # April 30, 2013 at 9:48 am


    #rightNav a:last

    is not this

    #rightNav a:last-child

    # April 30, 2013 at 9:48 am

    Go it working in code pen

    # April 30, 2013 at 9:50 am

    In any case, in your Codepen you have added the border to the `li` not the `a` so it should be

    #rightNav li:last-child

    # April 30, 2013 at 2:27 pm

    I agree with @jamy_za, I always use `first-child` for the extra browser support.

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.