Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS .last-child or???

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #301342
    helson
    Participant

    Hello together,

    i searched around but couldn’t find anything which helps concerning my problem.

    Can you please have a look to this codepen: https://codepen.io/helson/pen/eYmebGq ?

    I have two or more blocks of the following div with class “slider”. A additional div (sliders) is wrapping these togehter.

    
    
      < div class="slider" >
        < div class="col" >
          < div class="bs_tab_toponly" >
            < h1 class="tabheading" >tabheading< /h1 >
          < /div >
        < /div >
        < div class="w-100" >w-100< /div >
        < div class="col no-gutter" >< /div >col no-gutter
        < div class="w-100" >w-100< /div >
        < div class="col" >last-col ***RED***
          < div class="bs_tab_bottomonly" >bs_tab_bottomonly< /div >
        < /div >
      < /div >
    
    

    I want to style the last “col” containing “bs_tab_bottomonly” different – how can I achieve this?
    I played around with last-child, last-of-type but can’t find the solution.
    First-child works as expected (for me).

    Thank you in advance!

    BR
    heslon

    #301500
    Mattia Astorino
    Participant


    .sliders .slider:nth-child(2) .col:last-child {
    background-color: red;
    }

    #301503
    helson
    Participant

    Hello Mattia,

    thank you for your reply – this works for two container (.slider). But what if the number of “.slider”-divs vary?

    BG
    helson

    #302547
    thompsonmax
    Participant

    Hello there. Interesting thread, thanks for the information.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.