无框文本字段在html页面中

时间:2014-07-03 19:51:28

标签: html css user-interface

是否有一个JavaScript或css库,它隐藏了文本字段的所有边框并使其看起来像是在写一行?

我没有一个例子。

4 个答案:

答案 0 :(得分:2)

无需使用某些库。这样的结果将给出内容可编辑的跨度(在写入时添加一些样式来删除它周围的边框):

<span contenteditable style="outline:0px solid transparent;" ></span>

类似的结果会给出内容可编辑的div,但它可以设置得更好,因为它是块

<div contenteditable style="outline:0px solid transparent;" ></div>

没有边框,你可以在里面写任何东西。

答案 1 :(得分:0)

简单的CSS应该可以工作

<style>
input {
   background-color: #fff; // your doc background color
    border: 0px;

概要:无;     }     

答案 2 :(得分:0)

我认为一个好的解决方案是使用@Mark的答案,但使用css类:

CSS中的

.inline-input {
   background-color: #fff; // your doc background color
   border: 0px;
   display: inline;
}

/*  and if you also don't want the outline when input get focus */
.inline-input:focus {
   outline: none;
}
HTML中的

Some text before <input type="text" class="inline-input" name="xxx"/> some text after

答案 3 :(得分:0)

如果您正在使用镶边,则该字段在选中时仍然会突出显示,因此尽管字段周围没有边框,但方形突出显示使其看起来好像是该字段处于焦点时。