ahr aitch Posted September 16, 2023 Share Posted September 16, 2023 (edited) In going through the CSS Flexbox tutorial I encountered the code in the screenshot that I don't understand and can't find an answer for searching online. It appears that there are 2 .flex-container declarations. Why are there 2? Why does the second one (in the attached ss, .flex-container > div { etc) exist. It puzzles me. I could find no explanation for having to have a second declaration nor for the "> div" syntax. Obviously, this declaration defines the container, but why couldn't that have been done in a single declaration? Could someone please explain this for me? Edited September 16, 2023 by ahr aitch clarity Link to comment Share on other sites More sharing options...
Ingolme Posted September 16, 2023 Share Posted September 16, 2023 The ">" is a child selector. It selects all <div> elements which are contained inside an element with class="flex-container" Information about it and similar things is on this page: https://www.w3schools.com/css/css_combinators.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now