Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    320
    Thanks
    51
    Thanked 1 Time in 1 Post

    :last selector not working

    On this website, I have the CSS:

    Code:
    .widget:last {
    	margin-bottom: 0;
    }
    However, the last div.widget still has a margin-bottom.

    What is wrong here?

    Thanks.

  2. #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    9,249
    Thanks
    4
    Thanked 932 Times in 919 Posts
    Which browser are you testing in?
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  3. #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    15,060
    Thanks
    165
    Thanked 2,250 Times in 2,237 Posts
    Did you mean
    Code:
    .widget:last-of-type {
        margin-bottom: 0;
    }
    ? (or perhaps :last-child)

  4. #4
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,836
    Thanks
    6
    Thanked 1,295 Times in 1,265 Posts
    Yeah, there is no :last pseudo class in CSS (ref), you need :last-child.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •