Home / CSS Tips Generated By ChatGPT / Styling First and Last Child in CSS Target the first and last child of a container for unique styling using :first-child and :last-child pseudo-classes. Source Code li:first-child { font-weight: bold; } li:last-child { font-style: italic; }