Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    May 2014
    Location
    Burnley
    Posts
    93

    how to use nth-child classes ?

    HI Guys !!!

    Can anybody tell me how to use first-child, last-child and nth-child classes ??

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Mar 2019
    Location
    Ahmedabad
    Posts
    132
    To use First child classes::
    Here first child will be colored red.
    Code:
    li:first-child {
      color:red;
    }
    To use Last child classes::
    Here last child will be colored red.
    Code:
    li:last-child {
      color:red;
    }
    To use nth child classes::
    Here all multiples of 2(like 2,4,6,8...) will be colored red.
    Code:
    li:nth-child(2n){
      color:red;
    }
    Here mentioned child(like here 5th child) will be colored red.
    Code:
    li:nth-child(5){
      color:red;
    }
    Last edited by Sherin; 05-14-2019 at 02:31 AM.

Posting Permissions

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

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.