I need to showcase my dynamic data from a database in a specific format that can accommodate anywhere from one to five variables. https://i.sstatic.net/pPQZE.png https://i.sstatic.net/gSJw6.png
How can I effectively display and present the data using HTML and CSS? I've attempted using div and span elements, but the results are not visually pleasing (refer to image number 3 for the current output).
<div style="margin: 5% 0 0 0" id="part">
<div style="width: 55%; margin-top: 3%; display: inline-block; vertical-align: top">
<p style="
transform: rotate(-90deg);
width: 175px;
height: 50px;
float: left;
background: gray;
color: #fff;
text-align: center;
padding-left: 10px;
padding-top: 15px;
margin: 40px 0 0 0">List1: {{ en.form.nbTotalCon }}</p>
<p>
<span style="display: block;margin-left: 98px; margin-bottom: 3px;background-color:darkgray "> {{ en.form.part1 }}</span>
<span style="display: block;margin-left: 100px;margin-bottom: 3px;"> {{ en.form.part2 }}</span>
<span style="display: block;margin-left: 100px;margin-bottom: 3px;background-color:darkgray "> {{ en.form.part3 }}</span>
<span style="display: block;margin-left: 100px;margin-bottom: 3px; "> {{ en.form.part4 }}</span>
<span style="display: block;margin-left: 100px;background-color:darkgray "> {{ en.form.part5 }}</span>
</p>
</div>
<div style=" width: 40%;margin-top: 3%; display: inline-block;vertical-align: top ">
<p style="
transform: rotate(-90deg);
width: 160px;
height: 50px;
float: left;
background: gray;
color: #fff;
text-align: center;
padding-left: 10px;
padding-top: 15px;
margin: 40px 0 0 0">
Projects:{{ en.form.nbTotalProj }} </p>
<p>
<span style="display: block;margin-left: 100px;background-color:darkgray"> {{ en.form.nomProj1 }} </span>
<span style="display: block;margin-left: 100px;"> {{ en.form.nomProj2 }}</span>
<span style="display: block;margin-left: 100px;background-color:darkgray"> {{ en.form.nomProj3 }} </span>
<span style="display: block;margin-left: 100px;"> {{ en.form.nomProj4 }}</span>
<span style="display: block;margin-left: 100px;background-color:darkgray"> {{ en.form.nomProje5 }} </span>
</p>
</div>
</div>
This is the current output based on the above code: