I have simple HTML / CSS code which should display the 5 most-used browsers used on the website. HTML:
<div class="content">
<div class="browserStat big">
<img src="{$basePath}/img/browser-chrome-big.png" alt="Chrome">
<span>36%</span>
</div>
<div class="browserStat big">
<img src="{$basePath}/img/browser-firefox-big.png" alt="Firefox">
<span>34%</span>
</div>
<div class="browserStat">
<img src="{$basePath}/img/browser-ie.png" alt="Internet Explorer">
<span>34%</span>
</div>
<div class="browserStat">
<img src="{$basePath}/img/browser-safari.png" alt="Safari">
<span>34%</span>
</div>
<div class="browserStat">
<img src="{$basePath}/img/browser-opera.png" alt="Opera">
<span>34%</span>
</div>
</div>
I also have all the percentages and browsers in my array from the database (browsers are saved as numbers, so for example 1 = IE , 2= Chrome , etc.)
I can easily echo it out like:
foreach($borowser as $elem){
echo '<div>
<div class="country">'.$elem["borowser"].'</div>
<div class="number">'.$elem["number"].'</div>
</div>';
}
So basically it looks I have everything which is needed, but I have problem with writing a correct cycle that doesn't break up this HTML / CSS, because it has to always have just 2 browsers with big
class and 3 with no big
class.
Can somebody help me to write cycle which will not break this HTML / CSS ?