Ia m trying to make this card design from Figma and code it in HTMl/CSS but I am having a bit of issues.
h
Here is an image of the design itself
And here is what I have currently made looks like: (note: I had to zoom out of page because it wouldn’t be visible otherwise)
Here is the HTML code for it:
<div class="cards-container">
<div class="box1_1">
<div class="box1_3">
<p>CAREY</p>
<h1>1</h1>
</div>
<div class="box1_2">
<p>On 56 Points</p>
</div>
</div>
<div class="box1_1">
<div class="box1_3">
<p>CAREY</p>
<h1>1</h1>
</div>
<div class="box1_2">
<p>On 56 Points</p>
</div>
</div>
<div class="right-cards-container">
<div class="box1_1">
<div class="box1_3">
<p>CAREY</p>
<h1>1</h1>
</div>
<div class="box1_2">
<p>On 56 Points</p>
</div>
</div>
<div class="box1_1">
<div class="box1_3">
<p>CAREY</p>
<h1>1</h1>
</div>
<div class="box1_2">
<p>On 56 Points</p>
</div>
</div>
</div>
</div>
And here is the CSS code for it:
.box1_1 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 262px;
height: 276px;
background: gray;
opacity: 1;
border-radius: 44px;
box-shadow: -10.746728897094727px 9.851167678833008px 60px rgba(0, 0, 0, 0.09000000357627869);
overflow: hidden;
position: relative;
}
.box1_3 {
padding-top: 20%;
font-size: 25px;
font-weight: bold;
text-align: center;
background: white;
height: 100%;
width: 100%;
position: absolute;
top: 10;
}
.box1_2 {
font-size: 25px;
font-weight: bold;
text-align: center;
background: #f6df6f;
height: 35%;
width: 100%;
position: absolute;
bottom: 0%;
box-shadow: -10.746728897094727px 9.851167678833008px 60px rgba(0, 0, 0, 0.09000000357627869);
/* Add the same box-shadow as the parent container */
}
.box1_3 h1 {
font-size: 72px;
margin-top: -10px;
}
.box1_2 p {
font-size: 18px;
}
.cards-container {
display: flex;
align-items: center;
flex-direction: column;
gap: 50px;
margin-top: 50px;
}
.right-cards-container {
display: flex;
flex-direction: row;
gap: 50px;
align-items: flex-end;
align-self: flex-end;
}
.right-cards-container .box1_1 {
width: 205px;
height: 215px;
}
I would appreciate it if someone can help me please.
Thanks.
I tried to a main container for all the cards and a seperate container for right cards and left cards. But I don’t know how to format it properly to be responsive too.
2
Answers
If i were you i would use bootstrap (or another css framework) but if you need to use plan html/css then you could do something like this:
Edit: Here is how i would do it using bootstrap
CSS Grid can do this quite easily.
In reality, the layout is accomplished in just a few lines of code in the media query in the example below. For all screens up to 50em, the
.grid
container is set to just auto-flow its children in a column. After the breakpoint is reached, I created a grid-template that allows you to place the first, second, third and fourth place cards into specific areas using a simple name (e.g.,.first { grid-area: first; }
).