Search code examples
htmlcssaddthis

Last-Child inside div not working


I and using addthis share plugin and have changed background color to yellow and also added bottom-border: of 1px, I want to remove the bottom border from the last a which is not working for me using following css

css

div#at4-share a:last-child
{
  border-bottom: 0px solid #1f1f1f; 
}

HTML

<div id="at4-share" class="addthis_32x32_style atss atss-left addthis-animated slideInLeft at4-show">
  <a class="at4-share-btn at-svc-facebook" href="#">
    <span class=" at4-icon aticon-facebook" title="Facebook">Facebook</span>
  </a>
  <a class="at4-share-btn at-svc-twitter" href="#">
    <span class=" at4-icon aticon-twitter" title="Twitter">Twitter</span>
  </a>
  <a class="at4-share-btn at-svc-pinterest_share" href="#">
    <span class=" at4-icon aticon-pinterest_share" title="Pinterest">Pinterest</span>
  </a>
  <a class="at4-share-btn at-svc-google_plusone_share" href="#">
    <span class=" at4-icon aticon-google_plusone_share" title="Google+">Google+</span>
  </a>
  <a class="at4-share-btn at-svc-compact" href="#">
    <span class=" at4-icon aticon-compact" title="More">More</span>
  </a>
  <div id="at4-scc" class="at-share-close-control ats-transparent at4-show at4-hide-content" title="Hide">
    <div class="at4-arrow at-left">Hide</div>
  </div>
</div>

I had tried

div#at4-share a:last-of-type
{
  border-bottom: 0px solid #1f1f1f; 
}

so i am not sure what is wrong


Solution

  • The correct selector is :last-of-type.

    div#at4-share > a:last-of-type
    {
      border-bottom:none; /* To remove the bottom border. */
    }
    

    FIDDLE