尝试以下两种方法:
.none::-webkit-resizer {
display: none;
}
.pic::-webkit-resizer {
background: url(http://www.zhangxinxu.com//study/image/selection.gif);
outline: 1px dotted #000;
}
<textarea class="none"></textarea>
<textarea class="pic"></textarea>
-webkit-
浏览器中工作,那么火狐浏览器等怎么办? - om_jaipur如果没有使用resize:none;
属性,您无法删除调整大小手柄。但是您可以将一个div
定位在这些虚线上(调整大小手柄)。请参见此处的演示。
textarea {
position: relative;
margin: 20px 0 0 20px;
z-index: 1;
}
.wrap {
position: relative;
display: inline-block;
}
.handle-hide {
height:12px;
width:12px;
position: absolute;background:#fff;
bottom: 2px;
right: 2px;
pointer-events: none;
z-index: 2;
}
<div class="wrap">
<div class="handle-hide"></div>
<textarea placeholder="drag the cyan triangle..."></textarea>
</div>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Resizable - Textarea</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style>
.ui-resizable-se {
bottom: 17px;
}
</style>
<script>
$(function() {
$( "#resizable" ).resizable({
handles: "se"
});
});
</script>
</head>
<body>
<textarea id="resizable" rows="5" cols="20"></textarea>
</body>
</html>
只需添加以下内容即可覆盖CSS:
<style>
.ui-icon, .ui-widget-content .ui-icon {
background-image: none;
}
</style>
after:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
你考虑过遮罩方案吗?
这里有一个基本示例(仅在Chrome上测试过):
textarea {
border: 1px solid #000;
box-shadow: inset .3em 0 #000,
inset -.3em 0 #000,
inset 0 .3em #000,
inset 0 -.3em #000;
padding: 10px;
}
演示:http://jsfiddle.net/onzqnk5v/
更新(基于评论):
这个答案只是一个考虑的概念。示例代码旨在说明概念,而不是作为最终解决方案。
你好,这里是我回答的一个可行示例:点击此处
首先需要指出的是,这基于CSS3的resize属性,在所有浏览器中并不完全支持。
HTML
<div class="resize_this">
<textarea class="no_dots"></textarea>
</div>
ENDS HTML
CSS3
.no_dots{
resize: none;
width: 100%;
height: 100%;
border:none;
}
.resize_this{
resize:both;
overflow: hidden;
border:2px solid black;
border-radius: 5px;
/*HERE PLACE DEFAULT SIZE FOR THE TEXTAREA*/
width: 50%;
height: 250px;
}
ENDS CSS3
希望这可以帮到你 T04435
<div id="d2" class="ui-widget-content" contenteditable>
I look like textarea :)
</div>
css 代码
#d2{
-moz-appearance: textfield;
-webkit-appearance: textfield;
background-color: white;
background-color: -moz-field;
border: 1px solid darkgray;
box-shadow: 1px 1px 1px 0 lightgray inset;
font: -moz-field;
font: -webkit-small-control;
margin-top: 5px;
padding: 2px 3px;
width: 300px;
height: 200px;
}
jquery代码
$(function() {
$( "#d2" ).draggable({revert: function(obj){
if (obj === true) {
// success
return false;
}
else {
// reverting
var offset = $(this).offset();
var xPos = offset.left;
var yPos = offset.top;
$("#d2").css("width", $("#d2").width()+xPos);
$("#d2").css("height", $("#d2").height()+yPos );
return true;
}
}});
});
textarea
。 - om_jaipur