开发者

How do I add an image to this text?

<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified'>This User is Verified!<div>";
        }
?>

In addition to the text "This User is Verified", how can I make an image display just to the right or just above the text?

ADDED TEST FILE FOR THIS WORK http://neighborrow.com/wanted_test.php开发者_运维技巧?item=116


With an img element (note that the section on alt text is a little lacking in that article, so also see this document).


another way to do this is adding a css class to your DIV element

CSS code:

.user_verified {
    background: url(../images/user_verified.png) no-repeat 0 0;
    padding-left:20px;
}

PHP code:

<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified' class='user_verified'>This User is Verified!<div>";
        }
?>


With an <img> tag:

<?php
    if (mysqli_num_rows($new_result) == 1)
        {
            if ($row['borrowingPower'] == 'mayor')
                print "<div id='verified'>This User is Verified! <img src='icon_ok.png' style='vertical-align: middle' alt='' /><div>";
        }
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜