用背景覆盖不同的图像:url?

时间:2017-11-14 16:16:32

标签: html css

下面的代码将使用foreach循环查询结果,该结果始终使用guild_logo返回数据库中的最后5个公会。

前三个公会将在他们的基地增加一个奖杯,那部分正在运作,但我想要添加的是在图像的顶部写“Lvl X”。更多指定将在下面的图片中的红色矩形处写一些东西

Guild_logo

<?php
    echo '
        <style type="text/css">
            #imgguild {
                border: 1.5pt solid #333332;
                border-radius: 10px;
                background-color: rgba(2, 18, 34, 0.38);
                box-shadow: inset 0px 0px 10px rgba(0,0,0,0.5);
            }
        </style>';

        // $query will always return the last five guilds and can have a diferent guild_logo. For example the first can be guild_logo1.gif the second guild_logo2.gif in that query I receive that, but below I use "guild_logo".gif to ilustrate.
        foreach ($query as $k => $v) {
            $count++;
            echo '
            <td style="width: 25%; text-align: center;">
                <a href="url">';
                    // All the guilds returned in that query should write Lvl X. Also the three first guilds will add a guild_overlay$count.gif.
                    if ($count <= 3) {
                       echo '<img id="imgguild" style="background:url(guild_logo.gif); background-size: 100%; overflow: hidden;" src="images/guild_logo/guild_overlay'.$count.'.gif" width="100" height="100" border="0"/>';
                    } else {
                        echo '<img src="guild_logo.gif" width="100" height="100" border="0"/>';
                    }
                echo '</a>
            </td>';
        }
    ?>

如何做到这一点?

0 个答案:

没有答案