溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

html+css如何制作div標(biāo)簽增加右上角刪除圖標(biāo)

發(fā)布時(shí)間:2021-03-19 09:38:02 來源:億速云 閱讀:779 作者:小新 欄目:web開發(fā)

這篇文章主要介紹html+css如何制作div標(biāo)簽增加右上角刪除圖標(biāo),文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

一、需求描述

在Div標(biāo)簽的右上角顯示刪除圖標(biāo)

二、實(shí)現(xiàn)方式

html、CSS

三、參考代碼

<style>
.container{
        width:60px;
        height:60px;
        border: 1px dotted red;
        position: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://www.iconpng.com/download/png/61252" class="delete" &omicron;nclick="alert(1)"/>
        <div class="content">content</div>
</div>
<div class="container">
        <img src="http://www.iconpng.com/download/png/61252" class="delete"/>
        <div class="content">content</div>
</div>

附錄:在輸入框左邊加一個(gè)小圖標(biāo),css樣式應(yīng)該怎么寫?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
<style>
.text{border:solid 2px #ccc;width:400px;height:40px;background:url(http://d.lanrentuku.com/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-indent:32px;}
 
</style>
</head>
 
<body>
<div class="text">
    <input type="text"/>
</div>
</body>
</html>

以上是“html+css如何制作div標(biāo)簽增加右上角刪除圖標(biāo)”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI