My website features an arrangement of pictures placed within div boxes and positioned absolutely to my liking.
.char1 - .char5
are correctly positioned. Now, I am seeking a way to align .char6 - .char10
directly under .char1 - .char5
. Is there a smart approach to achieve this alignment consistently across different screen sizes?
Additionally, the .char
divs share similar attributes except for the "left" and "top" positions. Is there a method to streamline these common values?
Thank you in advance.
* {
background-color: #151515;
}
.h {
align-self: center;
width: 96%;
height 100%;
border-style: solid;
border-width: 0px;
border-color: 817B6F;
}
.chars {
display: flex;
width: 10%;
height: auto;
background-color: 817B6F;
position: absolute;
top: 10%;
left: 25%;
}
.char1 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 10%;
height: auto;
left: 21.5%;
border-top-left-radius: 5px;
padding: 0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char2 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 10%;
height: auto;
left: 32.9%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char3 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 10%;
height: auto;
left: 44.3%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char4 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 10%;
height: auto;
left: 55.7%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char5 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 10%;
height: auto;
left: 67.1%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
border-top-right-radius: 5px;
}
.char6 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 33%;
height: auto;
left: 21.5%;
border-bottom-left-radius: 5px;
padding: 0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char7 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 33%;
height: auto;
left: 32.9%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char8 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 33%;
height: auto;
left: 44.3%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char9 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 33%;
height: auto;
left: 55.7%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
}
.char10 {
justify-content: center;
display: flex;
background-color: 817B6F;
position: absolute;
width: 10%;
top: 33%;
height: auto;
left: 67.1%;
padding:0.7%;
border-width: 1px;
border-color: black;
border-style: solid;
border-bottom-right-radius: 5px;
}
<div class="char1">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char2">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char3">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char4">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char5">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char6">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char7">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char8">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char9">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>
<div class="char10">
<img class= "h" name= Warrior src="http://placehold.it/256" />
</div>