简体   繁体   中英

Insert tag a right after img

Have look on this code:

<a href="#" class="list-group-item">
    <span class="badge"><?=$st ?></span>
    <img class="small_profile_pic" src="<?=$pic ?>" /> aaa<a href="#"><?=$msg['UserName'] ?></a> :
</a>

this is a row that show a message in short type. in this row I need to <a href="#"><?=$msg['UserName'] ?></a> be after image but it going to next line. when I type word without a tag its OK but links goes to next line. How do I fix this?

more explanation on this pic: 看这张照片

Please notice that I can't use float , if there is another way except float please tell me that.

Edited:

(I have fixed that place by changing parent tag to span but ...) I need to make whole row a link to that specific message and make username a link to user profile. Who can I place links inside each other?Or another solution maybe?

Second Edit

I have placed a tags inside each other and both of them works well but still second a tag goes to next line! I have tried display:inline but whole row collapsed!

You can't use 'a' tag in "a" tag .... but just for you If you want to align it after image use style property and use ,

<a href="#" class="list-group-item">
    <span class="badge"><?=$st ?></span>
    <img class="small_profile_pic" src="<?=$pic ?>" style="display:inline" /> aaa<a href="#" style="display:inline"><?=$msg['UserName'] ?></a> :
</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM