MORE CSS FORMATTING
DOM: Document Object Model
What are trees?
Or more like this…
A Better Example Sam & Bessie Al & Jewel Paul & Dawn Leo & Bea Abby & Phil Peter & Cate Kari & Hal Mark & Dina Tess & John Barb & Ray Sue Dan & Cora Stu & Chi Mary Leah Al Lori Jen Andy Jake Noah Ben Amy Di Sara Moe Andy Lady
Descendents Sam & Bessie Al & Jewel Paul & Dawn Leo & Bea Abby & Phil Peter & Cate Kari & Hal Mark & Dina Tess & John Barb & Ray Sue Dan & Cora Stu & Chi Mary Leah Al Lori Jen Andy Jake Noah Ben Amy Di Sara Moe Andy Lady
Children Sam & Bessie Al & Jewel Paul & Dawn Leo & Bea Abby & Phil Peter & Cate Kari & Hal Mark & Dina Tess & John Barb & Ray Sue Dan & Cora Stu & Chi Mary Leah Al Lori Jen Andy Jake Noah Ben Amy Di Sara Moe Andy Lady
Children Sam & Bessie Al & Jewel Paul & Dawn Leo & Bea Abby & Phil Peter & Cate Kari & Hal Mark & Dina Tess & John Barb & Ray Sue Dan & Cora Stu & Chi Mary Leah Al Lori Jen Andy Jake Noah Ben Amy Di Sara Moe Andy Lady
Siblings Sam & Bessie Al & Jewel Paul & Dawn Leo & Bea Abby & Phil Peter & Cate Kari & Hal Mark & Dina Tess & John Barb & Ray Sue Dan & Cora Stu & Chi Mary Leah Al Lori Jen Andy Jake Noah Ben Amy Di Sara Moe Andy Lady
HTML Creates a tree: DOM HTML tags create a tree Called the DOM (Document Object Model) Formatting correctly makes it obvious!
HTML body div footer header h1 ul div section p table p ul figure li tr tr li li div td td td td td td
HTML body div footer header h1 ul div section p table p ul figure child li li p p tr tr li li div td td td td td td siblings
Using the DOM CSS will allow us to format selectively based on the tree
CSS Selectors context tag { context > tag { Context + tag { Applies to any tag inside context Space is a descendant selector context > tag { Applies to any tag directly inside context > is a child selector Context + tag { Applies only to a tag that DIRECTLY FOLLOWS a context + is an adjacent sibling selector
HTML body div footer header h1 ul div section p table p ul figure li tr tr li li div td td td td td td
Child pseudo elements W3schools first-child, last-child, nth-child(), nth-last-child() () options: Number Even-odd Formula Every 3rd would be 3n+0 4, 7, 11 would be 3n+1 nth-last-child counts from end