Tell us what’s happening:
- The flexbox layout on my middle class selector is not fully centered ,both vertically and horizontally.
2.I am trying to embed a span with the class ‘red’ to change the color into another span with the class ‘rotate’ to change the position, where both are embedded in the same div (class ‘middle’), but nothing happens.
Please explain, seniors.
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Playing Cards</title>
</head>
<body>
<main id="playing-cards">
<div class="card">
<div class="left">A<br>♠</div>
<div class="middle">♠</div>
<div class="right">A<br>♠</div>
</div>
<div class="card">
<div class="left">2<br>♣</div>
<div class="middle">♣<br><span class="span">♣</span></div>
<div class="right">2<br><span class="rotate">♣</span></div>
</div>
<div class="card">
<div class="left">5<br><span class="red">♦<span></div>
<div class="middle"><span class="red">♦♦<br>♦<br>♦♦<span></div>
<div class="right">5<br><span class="rotate"><span class="red">♦<span></span></div>
</div>
<div class="card">
<div class="left">3<br><span class="red">♥<span></div>
<div class="middle"><span class="red">♥<br>♥<br><span class="rotate">♥</span></span></div>
<div class="right">3<br><span class="red">♥<span></div>
</div>
<div class="card">
<div class="left">4<br>♣</div>
<div class="middle">♣♣<br><span class="rotate">♣♣<span></div>
<div class="right">4<br>♣</div>
</div>
</main>
</body>
</html>
/* file: styles.css */
body{
background-color:#d7c6;
}
*{
box-sizing: border-box;
}
#playing-cards{
margin: 20px auto;
Display:flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
max-width: 1001px;
}
.card{
display:flex;
flex-direction:row;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
width:100%;
max-width:301px;
height:449px;
border: 2px solid black;
border-radius: 9px;
box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
background-color: #f9f8f9;
}
.left{
align-self: flex-start;
padding: 9px;
font-size: 47px;
}
.middle{
display:flex;
align-self: center;
font-size:69px;
flex-direction: column;
justify-content: center;
}
.right{
align-self : flex-end;
padding: 9px;
font-size: 47px;
transform: rotate(180deg);
}
.rotate{
transform: rotate(180deg);
}
.red{
color:red;
}
#playing-cards::after{
content: "";
width: 301px;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0
Challenge Information:
Build a Page of Playing Cards - Build a Page of Playing Cards

