2013-08-17 24 views

回答

2

以下是您正在查找的内容。

HTML

<div id="editable" contentEditable="true"></div> 

CSS(并非必需,但只是为了让DIV的样子输入框)

#editable{ 
    border: 1px solid black; 
    height: 100px; 
    width: 400px; 
} 

Working Demo

注:参考Aditya对Browser Comp的回答atibility。如果你想支持列表之外的任何浏览器,请不要使用它。

+1

非常感谢我的朋友!!!! – kasiri182

+0

我的朋友最后questin ....我可以编辑这个div例如给风格? – kasiri182

+0

是的,你可以使用CSS来设计div的样式(就像我在上面的例子中所做的那样) – Harry

0

看看这是你想要什么:http://jsbin.com/eqEPAci/1/edit

CSS:

.styles{ 
     height:30px; 
    width:286px; 
    -moz-border-radius: 4px; 
    -webkit-border-radius: 4px; 
    border-radius: 4px; 
    -moz-background-clip: padding; 
    -webkit-background-clip: padding-box; 
    background-clip: padding-box; 
    border: 1px solid #5E5E5E; 
    padding:0px 5px; 
     background-color: #000000; 
     color:#BFBFBF; 
     outline: none; 
     input-align: center; 
} 

.abs-centered { 
    margin: auto; 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    top: 0; 
    right: 0; 
} 

#actual-input{ 
    height:26px; 
    padding:0px; 
    width:100%; 
    color:#fff; 
    background-color:transparent; 
    border:0px; 
    outline-style:none; 
} 

HTML:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset=utf-8 /> 
<title>JS Bin</title> 
</head> 
<body bgcolor="#25383C"> 
    <div class="styles abs-centered"> 
    <input id="actual-input" name="name" type="password" placeholder="Password" autocomplete="off"/> 
    </div> 
</body> 
</html> 

备选:

<div contentEditable></div> 

Browser Compatibility

0

使用contentEditable="true"为DIV

属性是这样的:

<div contentEditable="true"></div> 

Demo Fiddle

但要小心,这是HTML5老的浏览器不支持它

相关问题