输入文本字段与关闭按钮

时间:2015-05-11 10:56:02

标签: javascript css html5 css3 twitter-bootstrap-3

我只想在右上角创建一个带有小x(关闭)按钮的输入文本字段。请帮我说明如何在css3或bootstrap 3中完成它。谢谢

2 个答案:

答案 0 :(得分:1)

这是一个简单的demo

HTML:

<input type="text"><span class="close-icon">x</span>

的CSS:

    .close-icon{
       position:relative;
       left: -14px;
       top: -4px;
    }

答案 1 :(得分:0)

Check this

HTML

<div class="main-content">
     <a href="javascript:void(0);" class="close">X</a>
   Dummy Text will be here..  Dummy Text will be here.. 
</div>

CSS

.main-content{
    border:1px solid #aaa;
    height:200px;
    width:50%;
    position:relative;
    padding:10px;
    font-family: arial;
    font-size:12px;
}
.close{
    position: absolute;
    right:5px;
    top:5px;
    text-decoration: none;
    font-family: arial;
    color:#fff;
    background-color: #aaa;
    padding:3px 5px
}