Hi everyone. I am currently in the midst of completing the challenge project for the 'Improved styling with css" section.
I have a problem. One, i want my text in the div that says the color and the hex code to be centered in the div but it is not happening. Two i want the 4 divs to be centered in the class colorSelection div. I don’t know why its not working.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Anek+Devanagari:wdth,[email protected],500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>My Webstie Style Guide</h1>
</header>
<section class="colorSection">
<div class="firstWebsiteColorSection">
<h2 class="colorSectionTitle">First website color selection</h2>
<div class="colorSelection">
<div class="firstWebsiteColor colorCard">
<h3>Color 1</h3>
<p>#D9EDBF</p>
</div>
<div class="firstWebsiteColor2 colorCard">
<h3>Color 2</h3>
<p>#FF9800</p>
</div>
<div class="firstWebsiteColor3 colorCard">
<h3>Color 3</h3>
<p>#2C7865</p>
</div>
<div class="firstWebsiteColor4 colorCard">
<h3>Color 4</h3>
<p>#90D26D</p>
</div>
</div>
</div>
<div class="secondWebsiteColorSection">
<h2 class="colorSectionTitle">Second website color selections</h2>
<div class="secondWebsiteColor colorCard">
<h3>Color 1</h3>
<p>#003C43</p>
</div>
<div class="secondWebsiteColor2 colorCard">
<h3>Color 2</h3>
<p>#135D66</p>
</div>
<div class="secondWebsiteColor3 colorCard">
<h3>Color 3</h3>
<p>#77B0AA</p>
</div>
<div class="secondWebsiteColor4 colorCard">
<h3>Color 4</h3>
<p>#E3FEF7</p>
</div>
</div>
</section>
</body>
</html>
*{
font-family: "Anek Devanagari", sans-serif;
font-weight: 500;
}
.colorSection{
width: 75%;
border: 1px solid black;
margin: 0 auto;
border-radius: 5px;
}
.colorSectionTitle{
padding-left: 20px;
}
.colorSelection{
width: 90%;
margin: 0 auto;
}
.colorCard{
width: 18%;
padding: 5px 10px;
border-radius: 5px;
display: inline-block;
margin: 0 auto;
}
/* First Website Color Section Styles */
.firstWebsiteColor{
background-color: #D9EDBF;
}
.firstWebsiteColor2{
background-color: #FF9800;
}
.firstWebsiteColor3{
background-color: #2C7865;
}
.firstWebsiteColor4{
background-color: #90D26D;
}
/* Second Website Color Section Styles */
.secondWebsiteColor{
background-color: #003C43;
}
.secondWebsiteColor2{
background-color: #135D66;
}
.secondWebsiteColor3{
background-color: #77B0AA;
}
.secondWebsiteColor4{
background-color: #E3FEF7;
}
I just want to center div.color selection evenly… I feel like i can do that with display:flex however i am not on that module yet…
I don’t know if i have made my query clear.