gpt4 book ai didi

php - 使用 jquery php css 将删除图标放在图像的一 Angular

转载 作者:行者123 更新时间:2023-12-01 02:12:08 25 4
gpt4 key购买 nike

这里将图像从数据库扔到 php 中的 div 中,同时,这里我想通过单击删除图标来删除图像,该图标必须位于从数据库中提取的每个图像的右上角。如何在图像的右上角获得删除图标?这就是我在对话框中显示图像的方式。

<?php        
$query = "SELECT * FROM files_images";
$res = mysql_query($query);
while ($row = mysql_fetch_array($res)) {
echo "<div id='popimages'>";
echo "<img title='$row[img]' id='$row[id]' style='width:100px;float:left; height:100px;margin-bottom:5px; margin-left:5px;border:2px solid #b06c1c;border-radius:10px;' src='http://localhost/PhpProject2/user_data/" . $row['filename'] . "'/>";
echo "</div>";
}
?>

最佳答案

如果我理解正确,请尝试输出如下内容:

HTML

  <div id='popimages'>
<div class="image">
<img class="btn-delete" onclick="alert('Do something!');" src="http://cdn1.iconfinder.com/data/icons/diagona/icon/16/101.png"/>
<img title='$row[img]' id='$row[id]' style='width:100px;float:left; height:100px;margin-bottom:5px; margin-left:5px;border:2px solid #b06c1c;border-radius:10px;' src='http://i.i.com.com/cnwk.1d/i/tim/2011/03/16/Chrome-logo-2011-03-16.jpg'/>
</div>
</div>

CSS:

.image {
width: 100px;
height: 100px;
position: relative;
}
.btn-delete {
position: absolute;
cursor: pointer;
right: 2px;
top: 2px;

/* This was edited out because it was stupid. See fernholz's answer.
left: 100%;
margin-left: -10px;
margin-top: 2px; */
}

JSFiddle:http://jsfiddle.net/TK7zB/

关于php - 使用 jquery php css 将删除图标放在图像的一 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15433950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com