Skip to main content

🚀 In our NEW AI Bootcamp you'll build a working app in 28 days, no experience required. Free to all subscription levels.

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

Join the Treehouse affiliate program and earn 25% recurring commission! 🤑

  • Treehouse Logo
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
    • All Courses
    • Tracks
    • AI Bootcamp
    • College Credit
    • Techdegree Bootcamps
    • Front End Development
    • Full Stack JavaScript
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
    • Explore
    • Career Toolbox
    • Free Treehouse Near Me
    • Affiliates
    • Blog
    • Support
    • About
    • Learn
    • Beginner's Guide to Coding
    • Data Analysis with SQL & Python
    • Front-End Web Development
    • Python Programming Basics
    • Techdegree Bootcamp Overview
    • UX Design Fundamentals
    • AI Tools for Beginners
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks AI Bootcamp College Credit
  • Techdegree Bootcamps Front End Web Development Full Stack JavaScript
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Explore Career Toolbox Free Treehouse Near Me Affiliates Blog Support About
    Learn Beginner's Guide to Coding Data Analysis with SQL & Python Front-End Web Development Python Programming Basics Techdegree Bootcamp Overview UX Design Fundamentals AI Tools for Beginners
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
Loading banner... Start your free trial at Treehouse
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
      • • Vibe Coding
  • Stephen Drake
    Stephen Drake
    784 Points

    :only child confused

    Posted July 15, 2023 10:49am by Stephen Drake
    Stephen Drake
    784 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • Yoko Iseki
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Yoko Iseki
    Front End Web Development Techdegree Student 7,524 Points

    Why "Item 1" is not affected by :only-child?

    Posted August 24, 2022 8:56pm by Yoko Iseki
    .a{fill-rule:evenodd;}techdegree
    Yoko Iseki
    Front End Web Development Techdegree Student 7,524 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • Eddie Harmon
    Eddie Harmon
    17,095 Points

    Unexpected result when using :empty

    Posted June 23, 2020 11:32pm by Eddie Harmon
    Eddie Harmon
    17,095 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • Jake Almendarez
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Jake Almendarez
    Front End Web Development Techdegree Student 4,250 Points

    for some reason the font size is still applied to all the elements even if after i add h1 and span tags.

    Posted June 12, 2020 3:46am by Jake Almendarez
    .a{fill-rule:evenodd;}techdegree
    Jake Almendarez
    Front End Web Development Techdegree Student 4,250 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • Sam Weeks
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Sam Weeks
    Front End Web Development Techdegree Student 16,699 Points

    :only child, tad confused...

    Posted January 23, 2020 3:04pm by Sam Weeks
    .a{fill-rule:evenodd;}techdegree
    Sam Weeks
    Front End Web Development Techdegree Student 16,699 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    3 Answers

  • Adam Duffy
    Adam Duffy
    4,466 Points

    :only-child psuedo class not displaying properly in Chrome.

    Posted September 2, 2019 9:07pm by Adam Duffy
    Adam Duffy
    4,466 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • James King
    James King
    5,529 Points

    Trouble Understanding :only-child

    Posted January 30, 2018 9:51pm by James King
    James King
    5,529 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • Aakash Srivastav
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Aakash Srivastav
    Full Stack JavaScript Techdegree Student 11,638 Points

    :only-child

    Posted January 12, 2018 8:21am by Aakash Srivastav
    .a{fill-rule:evenodd;}techdegree
    Aakash Srivastav
    Full Stack JavaScript Techdegree Student 11,638 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • Aakash Srivastav
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Aakash Srivastav
    Full Stack JavaScript Techdegree Student 11,638 Points

    :empty

    Posted January 12, 2018 7:10am by Aakash Srivastav
    .a{fill-rule:evenodd;}techdegree
    Aakash Srivastav
    Full Stack JavaScript Techdegree Student 11,638 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • bobdeei
    bobdeei
    8,575 Points

    :only-child no working as expected?

    Posted December 26, 2017 4:05am by bobdeei
    bobdeei
    8,575 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • Luca Di Pinto
    Luca Di Pinto
    8,051 Points

    Need help! Can you explain me bette how :only-child works??

    Posted September 27, 2016 8:59pm by Luca Di Pinto
    Luca Di Pinto
    8,051 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • Ross Alejandro Bendal
    Ross Alejandro Bendal
    8,993 Points

    I did a :empty and expect it to affect my <h1></h1>, but it did not. Any ideas why?

    Posted July 2, 2016 10:17am by Ross Alejandro Bendal
    Ross Alejandro Bendal
    8,993 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    2 Answers

  • Malcolm Stretten
    Malcolm Stretten
    3,814 Points

    can't make only-child code work

    Posted June 24, 2016 1:54pm by Malcolm Stretten
    Malcolm Stretten
    3,814 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    7 Answers

  • Francis N
    Francis N
    10,376 Points

    many people are concerned that chrome doesnt support :only-child but in the video, Guil is using Chrome....

    Posted February 6, 2016 2:22am by Francis N
    Francis N
    10,376 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    6 Answers

  • Dennis Marquez
    PLUS
    Dennis Marquez
    Courses Plus Student 2,791 Points

    My :empty doesn't work in Google Chrome. Any ideas?

    Posted November 24, 2015 5:31pm by Dennis Marquez
    Dennis Marquez
    Courses Plus Student 2,791 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    3 Answers

  • Sean Flanagan
    Sean Flanagan
    33,237 Points

    Why does my h1 appear on the left of the browser?

    Posted May 26, 2015 12:23pm by Sean Flanagan
    Sean Flanagan
    33,237 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    4 Answers

  • Richard Walton
    Richard Walton
    10,861 Points

    Different from video?

    Posted April 30, 2015 9:55am by Richard Walton
    Richard Walton
    10,861 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    1 Answer

  • Alexander Melo
    Alexander Melo
    4,297 Points

    Having Trouble with :only-child.

    Posted March 19, 2015 1:01am by Alexander Melo
    Alexander Melo
    4,297 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    12 Answers

  • Michał Gonciarz
    Michał Gonciarz
    13,549 Points

    Only child doesn't work

    Posted March 5, 2015 7:11pm by Michał Gonciarz
    Michał Gonciarz
    13,549 Points
    • CSS
    • CSS Selectors
    • Going Further with Attribute Selectors and Pseudo-Classes
    • :only-child and :empty

    10 Answers

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
SEE ALL

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
SEE ALL

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
SEE ALL

About Us

  • About
  • Blog
  • Community
  • Stories
  • Contact
  • Gift Card

Explore

  • Plans
  • Affiliates
  • Perks
  • Shop
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses

Treehouse is an online technology education platform founded in 2011. Treehouse offers more than 700 self-paced, video-based courses in web development, programming, data analysis, design, and AI, plus two project-based bootcamp programs in Front End Web Development and Full Stack JavaScript. Individual Treehouse plans start at $25 per month and include a 7-day free trial. Treehouse serves individual learners, businesses, schools, and public libraries. Cardholders at participating U.S. public libraries can use Treehouse for free. Select Treehouse courses, offered with University Pathways International, are recommended for college credit by ACE and NCCRS. Treehouse learners earn digital certificates for completed Tracks.

Terms & Conditions · Privacy · © 2026 Treehouse Island, Inc.
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
  • Discord