I currently have a collection of "cards" on my website that are jpg images, but I am considering switching to an HTML/CSS solution. This change would involve placing numerous small icons on a background and adding stylish text on top.
My concern is determining which method is faster for both the client and the server.
To help illustrate this dilemma, I quickly put together a rough example.
Original full image size is 111kb:
https://i.sstatic.net/jD2av.jpg
Rendering using HTML/CSS:
<div class="wrapper">
<img class="background" src="http://i.imgur.com/qCxyd9v.jpg">
<img class="icon one" src="http://i.imgur.com/c5Qx3x7.png">
<img class="icon two" src="http://i.imgur.com/4G8xUeM.png">
<img class="icon three" src="http://i.imgur.com/9Kips1U.png">
<img class="icon four" src="http://i.imgur.com/0utE9VD.png">
<img class="icon five" src="http://i.imgur.com/Ej7w0pA.png">
<img class="icon six" src="http://i.imgur.com/9EdnWnW.png">
<div class="text">
How can I measure the performance impact of this rendering approach?
</div>
</div>
.wrapper {
position: relative;
}
.icon {
position: absolute;
}
.icon.one {
left: 10px;
top: 20px;
}
.icon.two {
left: 140px;
top: 20px;
}
.icon.three {
left: 270px;
top: 20px;
}
.icon.four {
left: 400px;
top: 20px;
}
.icon.five {
left: 140px;
top: 150px;
}
.icon.six {
left: 270px;
top: 150px;
}
.text {
position: absolute;
left: 120px;
top: 350px;
font-size: 24px;
color: white;
text-align: center;
max-width: 300px;
}
The background image size is 73 kb, with each icon being 7kb, totaling to 115 kb.
Sometimes, some of the icons may be duplicates, reducing the overall file size. However, it's essential to consider the cost of positioning elements on the page.
How can I accurately measure the most efficient option? It seems like a case-by-case evaluation rather than a straightforward answer.
So, should I:
1) Figure out how to measure the best choice?
or
2) Accept that it doesn't make much difference in the end?