From 4634b5f7631fb1f210b55fee117248177b9cf43d Mon Sep 17 00:00:00 2001 From: Zekumoru Dragonhart Date: Wed, 29 Jun 2022 04:42:44 +0200 Subject: [PATCH 1/2] Change solutions for third and fourth elements Third and fourth elements share the same declaration for font-size. --- foundations/02-class-id-selectors/solution/solution.css | 3 +-- foundations/02-class-id-selectors/solution/solution.html | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/foundations/02-class-id-selectors/solution/solution.css b/foundations/02-class-id-selectors/solution/solution.css index 4383c65..3ba4635 100644 --- a/foundations/02-class-id-selectors/solution/solution.css +++ b/foundations/02-class-id-selectors/solution/solution.css @@ -3,7 +3,7 @@ font-family: Verdana, "DejaVu Sans", sans-serif; } -.oddly-cool { +.adjust-font-size { font-size: 24px; } @@ -14,6 +14,5 @@ #four { background-color: hsl(120, 100%, 75%); - font-size: 24px; font-weight: bold; } diff --git a/foundations/02-class-id-selectors/solution/solution.html b/foundations/02-class-id-selectors/solution/solution.html index 75b0b5a..9e47d63 100644 --- a/foundations/02-class-id-selectors/solution/solution.html +++ b/foundations/02-class-id-selectors/solution/solution.html @@ -10,8 +10,8 @@

Number 1 - I'm a class!

Number 2 - I'm one ID.
-

Number 3 - I'm a class, but cooler!

-
Number 4 - I'm another ID.
+

Number 3 - I'm a class, but cooler!

+
Number 4 - I'm another ID.

Number 5 - I'm a class!

\ No newline at end of file From baea35d4980ab38251af5d34758bf38e11dce6b4 Mon Sep 17 00:00:00 2001 From: Zekumoru Dragonhart Date: Sun, 10 Jul 2022 11:22:32 +0200 Subject: [PATCH 2/2] Add comment about reducing duplicate code --- foundations/02-class-id-selectors/solution/solution.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/foundations/02-class-id-selectors/solution/solution.css b/foundations/02-class-id-selectors/solution/solution.css index 3ba4635..ef9c0b7 100644 --- a/foundations/02-class-id-selectors/solution/solution.css +++ b/foundations/02-class-id-selectors/solution/solution.css @@ -12,6 +12,15 @@ font-size: 36px; } +/* + In the id selector 'four' below, we could have also + added a rule to set the font size to 24px. + + However, since the elements 'Number 3' and 'Number 4' + in the HTML file share the same font size, we reused + the 'adjust-font-size' class above to help reduce + duplicate code. +*/ #four { background-color: hsl(120, 100%, 75%); font-weight: bold;