in the div I have this stat/username box that is supposed to be close with the image but the image is supposed to be a little away to give it a nice effect, well the problem is I used position relative and I think that’s messing it up, I don’t know what other way to fix it and keep it responsive.
.top-container {
display: flex;
justify-content: space-around;
padding: 15px;
}
.u1 {
display: flex;
align-items: center;
position: relative;
margin: 50px;
}
.u2 {
width: 70px;
height: 70px;
border-radius: 50%;
position: relative;
top: 70px;
right: 50px;
z-index: 1;
}
.u3 {
background: rgba(90, 211, 238, 0.166);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 20px 50px;
justify-content: center;
}
.u4 {
background: rgba(90, 211, 238, 0.166);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 20px 50px;
display: flex;
justify-content: right;
}
.u5 {
width: 100px;
height: 100px;
position: relative;
top: 70px;
right: 50px;
z-index: 1;
}
<div class="top-container">
<div class="u1">
<img src="https://cdn.discordapp.com/avatars/870413726711435297/81a888d3981c992aee63d3c99531285e.webp?size=1024" class="u2" />
<div class="u3">yumbo1z</div>
</div>
<div class="u1">
<img src="https://cdn.discordapp.com/attachments/1134291282873810975/1327335746646052904/IMG_2820.png?ex=6782b13e&is=67815fbe&hm=7f48431c52523089dff49abed5ccb94955c049f770c4568aab9ee89d7964792c&" class="u5" />
<div class="u4">9,100</div>
</div>
<div class="u1">
<img src="https://cdn.discordapp.com/attachments/1134291282873810975/1327335746163441805/IMG_2821.png?ex=6782b13e&is=67815fbe&hm=f2ed76276b89fdde6bcc076191309e29d0437caf6d0f624cc7e909bca075c8e4&" class="u5" />
<div class="u4">9,100</div>
</div>
<div class="u1">
<img src="https://cdn.discordapp.com/attachments/1134291282873810975/1327335746163441805/IMG_2821.png?ex=6782b13e&is=67815fbe&hm=f2ed76276b89fdde6bcc076191309e29d0437caf6d0f624cc7e909bca075c8e4&" class="u5" />
<div class="u4">9,100</div>
</div>
</div>
2
Answers
I think this is the nearest what you’re looking for.
I would recommend to use flex or grid for the positioning of the elements.
Hope, this helps.
The following are the most relevant points:
All
<div>
s were changed to semantic elements meant for specific a purpose.<main>
contains all of the content that’s not in the<header>
s or<footer>
.<figure>
contains content like charts or images.<figcaption>
should only reside within a<figure>
it’s purpose is to contain the text that describes or is a title of the content within a<figure>
.The 4
<figure>
s are centered vertically and spaced horizontally by a grid layout from<main>
‘s properties:Each
<figure>
has an<img>
and a<figcaption>
and they are centered vertically by each<figure>
‘s properties:The
:root
‘sfont-size
is the default for anyrem
lengths. Thefont-size
is indvmax
units which dynamically change in relation to either viewport width or height (whichever is currently the largest). So as the window changes so does everything that’s inrem
s.View in Full page mode and resize the window.