好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html+css制作div标签增加右上角删除图标的示例代码

一、需求描述

在Div标签的右上角显示删除图标

二、实现方式

ht ML 、CSS

三、参考代码

<style>
.cont ai ner{
        width:60px;
        h ei ght:60px;
        border: 1px dotted  red ;
        pos IT ion:relative;
}
.content{
        position:relative;
        top:20px;
}
.delete{
        width:20px;
        height:20px;
        border-radius:60%;
        position:absolute;
        top:-10px;
        right:-10px;
}
</style>
<div class="container">
        < img  src="http://HdhCmsTesticonpng .COM /download/png/61252" class="delete" οnclick="alert(1)"/>
        <div class="content">content</div>
</div>
<div class="container">
        <img src="http://HdhCmsTesticonpng测试数据/download/png/61252" class="delete"/>
        <div class="content">content</div>
</div>

附录:在输入框左边加一个小图标,css样式 应该 怎么写?

<!DOCTY PE  html P ub LIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://HdhCmsTestw3. org /TR/xhtml1/DTD/xhtml1 -t ransitional.dtd">
<html  XM lns="http://HdhCmsTestw3.org/1999/xhtml">
<head>
< ;m eta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.text{border:solid 2px  # ccc;width:400px;height:40px;background:url(http://d.lanrentuku测试数据/down/png/1211/blueberry/user_friend.png) no-repeat 0  center ;}
.text input{float:left;border:none;background:none;height:40px;line-height:30px;width:100%; text -i ndent:32px;}
 
</style>
</head>
 
<body>
<div class="text">
    <input type="text"/>
</div>
</body>
</html>

总结

到此这篇关于html+css 制作 div标签增加右上角删除图标的示例代码的 文章 就介绍到这了,更多相关div 右上角删除图标内容请搜索以前的文章或继续浏览下面的相关文章,希望大家以后多多支持!

总结

以上是 为你收集整理的 html+css制作div标签增加右上角删除图标的示例代码 全部内容,希望文章能够帮你解决 html+css制作div标签增加右上角删除图标的示例代码 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于html+css制作div标签增加右上角删除图标的示例代码的详细内容...

  阅读:44次