Pain Posted May 30, 2012 Share Posted May 30, 2012 Hi there. I am trying to put a "user is online" icon on top of a picture. What i've got so far is: html/php <div class="featured"><a href="user_profile.php?id=<?php echo $id2[1]; ?>"><img src="<?php echo $profile_picture2[1]; ?>" class="borders" /></a></div> css .featured { width: 136px; height: 136px; background-image: url('img/featured.jpg'); float: left; margin: 2px; } .borders { border: 4px solid #D8D8D8; height: 128px; width: 128px; } .on { width: 80px; height: 80px; background-image: url('img/on.png'); } I want to put class "on" on top of the image. I've tried many things, but just keep getting nothing or distorted layout. Any help pls:) Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/263383-png-on-top-of-jpg/ Share on other sites More sharing options...
Jessica Posted May 30, 2012 Share Posted May 30, 2012 Try using position: relative. Quote Link to comment https://forums.phpfreaks.com/topic/263383-png-on-top-of-jpg/#findComment-1349815 Share on other sites More sharing options...
Drongo_III Posted June 7, 2012 Share Posted June 7, 2012 You want to put a background image on the profile image?? Maybe i've totally misunderstood. You'd be better off making the parent div position:relative, then add absolute positioning to the profile pic and add the "user online" png. Then set the z-index of "user online" png to a higher value than the profile pic - that way it'll sit above the profile pic. But to my knowledge you can't add a background image to an image...err if that's what you were trying to do in the first place...which you probably werent hehe. Hi there. I am trying to put a "user is online" icon on top of a picture. What i've got so far is: html/php <div class="featured"><a href="user_profile.php?id=<?php echo $id2[1]; ?>"><img src="<?php echo $profile_picture2[1]; ?>" class="borders" /></a></div> css .featured { width: 136px; height: 136px; background-image: url('img/featured.jpg'); float: left; margin: 2px; } .borders { border: 4px solid #D8D8D8; height: 128px; width: 128px; } .on { width: 80px; height: 80px; background-image: url('img/on.png'); } I want to put class "on" on top of the image. I've tried many things, but just keep getting nothing or distorted layout. Any help pls:) Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/263383-png-on-top-of-jpg/#findComment-1351974 Share on other sites More sharing options...
Mahngiel Posted June 7, 2012 Share Posted June 7, 2012 You'd be better off making the parent div position:relative, then add absolute positioning to the profile pic and add the "user online" png. Then set the z-index of "user online" png to a higher value than the profile pic - that way it'll sit above the profile pic. Yes. But to my knowledge you can't add a background image to an image...err if that's what you were trying to do in the first place...which you probably werent hehe. No. Quote Link to comment https://forums.phpfreaks.com/topic/263383-png-on-top-of-jpg/#findComment-1351984 Share on other sites More sharing options...
Drongo_III Posted June 7, 2012 Share Posted June 7, 2012 haha thanks for the commentary You'd be better off making the parent div position:relative, then add absolute positioning to the profile pic and add the "user online" png. Then set the z-index of "user online" png to a higher value than the profile pic - that way it'll sit above the profile pic. Yes. But to my knowledge you can't add a background image to an image...err if that's what you were trying to do in the first place...which you probably werent hehe. No. Quote Link to comment https://forums.phpfreaks.com/topic/263383-png-on-top-of-jpg/#findComment-1351988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.