I was testing many options using CSS and HTML, but the closest I got of solving this problem was using HTML tables to align the images in the same line with their titles above each of them.
I did this:
`
<table>
<td>
<font color="white">Security</font><br><img src="security.png" width="100" height="100"><br><br>
</td>
<td>
<font color="white">UI/UX</font><br><img src="hacker.png" width="100" height="100"><br><br>
</td>
<td>
<font color="white">Cloud Technologies</font><br><img src="secret-file.png" width="100" height="100"><br><br>
</td>
<td>
<font color="white">Identity and Access Management</font><br><img src="face-recognition.png" width="100" height="100"><br><br>
</td>
<td>
<font color="white">Software Engineering</font><br><img src="bug.png" width="100" height="100"><br><br>
</td>
<td>
<font color="white">Cyber Intelligence</font><br><img src="hacking (1).png" width="100" height="100"><br><br>
</td>
</table>
`
I know you will suggest using CSS, but every CSS thing I tested, failed miserably, like flex box, float, etc. The problem with this solution is that I need like 3 or 4 images per line. Another problem is that this solution made the text above the image extremely close to each other (not centralized).
I tried using table and it was the closest I could do.
Other attempts was trying this: https://www.w3schools.com/howto/howto_css_images_side_by_side.asp but had no success with the text above the images. Also tried <figure style = "margin-left: 20%">, <figure style = "margin-left: 40%"> and <figure style = "margin-left: 60%">
but they didn’t get to be in the same line.
4
Answers
I would put the title and image in a single div like this:
And then flex them in a css:
Let me know if this works
I would recommend you to enhance your skills in using grid systems. Those can be very helpful in Situations like yours rn.
What you could also try if you really want to use a table is:
It would be cleaner if you’d either add your CSS style Tags to a class / the element itself due to repitition in each img element shown here. Same for your font element. you could just make white then.
You can do that using CSS Flexbox
This is using CSS Grid for the layout. The
<figure>
tag is used for the image content and the<figcaption>
for the image title.