How do You Center This on a Page Regardless of Viewport Size?
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I’ve been trying for hours to fix this problem, but it just won’t work. People have told me to use flex, align-content: center, align-items: center, etc, but I just can’t do it. If someone could figure this out for me and be gracious enough to add a simple explanation, I would greatly appreciate it.
<div class = ‘field-1’></div>
<div class = ‘field-2’></div>
<div class = ‘field-3’></div>
<div class = ‘field-4’></div>
<div class = ‘field-5’></div>
<div class = ‘field-6’></div>
<div class = ‘field-7’></div>
<div class = ‘field-8’></div>
<style>
.field-1 {
position: absolute;
display: flex;
width: 250px;
height: 150px;
top: 400px;
left: 65.2px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-2 {
position: absolute;
display: flex;
width: 250px;
height: 150px;
top: 400px;
left: 385.4px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-3 {
position: absolute;
display: flex;
width: 250px;
height: 150px;
top: 400px;
left: 705.2px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-4 {
position: absolute;
display: flex;
width: 250px;
height: 150px;
top: 400px;
left: 1025.4px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-5 {
position: absolute;
width: 250px;
height: 150px;
top: 620px;
left: 65.2px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-6 {
position: absolute;
width: 250px;
height: 150px;
top: 620px;
left: 385.4px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-7 {
position: absolute;
width: 250px;
height: 150px;
top: 620px;
left: 705.2px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
.field-8 {
position: absolute;
width: 250px;
height: 150px;
top: 620px;
left: 1025.4px;
box-shadow: 10px 10px;
background-color: #0f0f0f;
color: #5e00bc;
z-index: 2;
}
</style>
</div>
أضف إجابة