I was comparing the CSS I wrote to the CSS in the solution set and was curious about my choice in using certain selectors in my project. To preface, my CSS displayed the page correctly and as expected; I just wanted to see if my way of going about it is preferred/not preferred for any reason.
My question is along the lines of using:
h1.title {}
as opposed to:
.item h2 {}
My CSS:
body {
font-family: Helvetica;
}
div.container {
margin:auto;
padding:10px;
/* border: 1px solid red; reference */
}
h1.title {
font-family: Helvetica;
font-size: 100px;
font-weight:bold;
color:khaki;
text-align:center;
background-image: url(pattern.jpeg);
}
h2.category {
font-family:Helvetica;
font-size:32px;
font-weight:bold;
color:white;
}
.green {
background-color: mediumspringgreen;
}
.coral {
background-color: lightcoral;
}
.skyblue {
background-color: skyblue;
}
span.price {
font-family:Helvetica;
font-weight:bold;
color:blue;
}
Solution CSS:
h1,
h2,
h3,
p {
font-family: "Helvetica", sans-serif;
}
h1 {
background-image: url("https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-2/pattern.jpeg");
text-align: center;
font-size: 100px;
color: khaki;
}
.item h2 {
font-size: 32px;
color: white;
}
.price {
font-weight: bold;
color: blue;
}
#brush {
background-color: mediumspringgreen;
}
#frame {
background-color: lightcoral;
}A
#paint {
background-color: skyblue;
}
My HTML
<!DOCTYPE html>
<html>
<head>
<title>Dasmoto's Arts & Crafts</title>
<link href='style.css' rel='stylesheet' />
</head>
<body>
<div class='container'>
<h1 class="title">Dasmoto's Arts & Crafts</h1>
<h2 class="category green">Brushes</h2>
<img src='hacksaw.jpeg' alt="Brushes laying on a table." />
<h3 >Hacksaw Brushes</h3>
<p>Made of the highest quality oak, Hacksaw brushes are known for their weight and ability to hold paint in large amounts. Available in different sizes. <span class="price">Starting at $3.00 / brush.</span></p>
<h2 class="category coral">Frames</h2>
<img src='frames.jpeg' alt="Picture frames of varying colors." />
<h3 >Art Frames (assorted)</h3>
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. <span class="price">Starting at $2.00 / brush.</span></p>
<h2 class="category skyblue">Paint</h2>
<img src='finnish.jpeg' alt="Opened tubes of paint on a desk." />
<h3 >Clean Finnish Paint</h3>
<p>Imported paint from Finland. Over 256 colors available in-storem varying in quantity (1 oz. to 8 oz.). Clean Finnish paint microbinds to canvas, increasing the finish and longevity of any artwork. <span class="price">Starting at $3.00 / brush.</span></p>
</div>
</body>
</html>
Solution HTML
<!DOCTYPE html>
<html>
<head>
<title>Dasmoto's Arts & Crafts</title>
<link href="./resources/css/style.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1>Dasmoto's Arts & Crafts</h1>
<!-- Brushes Section -->
<div class="item">
<h2 id="brush">Brushes</h2>
<img src="https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-2/hacksaw.jpeg"/>
<h3>Hacksaw Brushes</h3>
<p>Made of the highest quality oak, Hacksaw brushes are known for their weight and ability to hold paint in large amounts. Available in different sizes. <span class="price">Starting at $3.00 / brush.</span></p>
</div>
<!-- Frames Section -->
<div class="item">
<h2 id="frame">Frames</h2>
<img src="https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-2/frames.jpeg"/>
<h3>Art Frames (assorted)</h3>
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. <span class="price">Starting at $2.00 / frame.</span></p>
</div>
<!-- Paint Section -->
<div class="item">
<h2 id="paint">Paint</h2>
<img src="https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-2/finnish.jpeg"/>
<h3>Clean Finnish Paint</h3>
<p>Imported paint from Finland. Over 256 colors available in-store, varying in quantity (1 oz. to 8 oz.). Clean Finnish paint microbinds to canvas, increasing the finish and longevity of any artwork. <span class="price">Starting at $5.00 / tube.</span>
</div>
</body>
</html>
I appreciate any and all feedback! Thank you!