
CSS Part 2
Descendant Selectors: Selects all elements inside another element (any level). It selects both direct child and nested child. <div> <p> This is paragraph 1 </p> <section> <p> This is paragraph 2 </p> </section> </div> div p { color: red; } Both paragraphs become red. Because both are inside ` <div> `. Child Selectors: Selects only direct children. < div > < p > This is direct child </ p > < section > < p > This is nested child </ p > </ section > </ div > div > p { color : blue ; } First paragraph alone -This is direct child , becomes blue . CSS Colors: Used to change text color. p { color : red ; } CSS Background: Used to style background of elements. Background Color: div { background-color : lightblue ; } Background Image: div { background-image : url("image.jpg") ; } Background Repeat: div { background-repeat : no-repeat ; } Background Size: div { background-size : cover ; } Background Position: div { background-position : center ; } Fonts and Text Styling CSS Box Model (margin, bo
Continue reading on Dev.to Tutorial
Opens in a new tab



