propriedades do clipe HTML DOM Estilo
Definição e Uso
grampear conjuntos de propriedades ou retorna a parte visível do elemento de posicionamento.
gramática
Definindo propriedades do clipe:
Object.style.clip="auto|rect(top right bottom left)|inherit"
propriedades do clipe Voltar:
Object.style.clip
值 | 描述 |
---|---|
auto | 默认。元素没有剪辑。 |
rect(top right bottom left) | 剪辑的形状由四个坐标定义。 |
inherit | clip 属性的值从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores suportam propriedade do clipe.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Exemplos
Exemplos
A imagem clipe para a forma especificada:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<style type="text/css">
img{
position:absolute;
top:100px;
}
</style>
<script>
function clipImage(){
document.getElementById("img1").style.clip="rect(0px 75px 75px 0px)";
}
function clearClip(){
document.getElementById("img1").style.clip="auto";
}
</script>
</head>
<body>
<img id="img1" src="w3javascript.gif" width="100" height="132">
<input type="button" onclick=clipImage() value="裁剪图片">
<input type="button" onclick=clearClip() value="不裁剪图片">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<style type="text/css">
img{
position:absolute;
top:100px;
}
</style>
<script>
function clipImage(){
document.getElementById("img1").style.clip="rect(0px 75px 75px 0px)";
}
function clearClip(){
document.getElementById("img1").style.clip="auto";
}
</script>
</head>
<body>
<img id="img1" src="w3javascript.gif" width="100" height="132">
<input type="button" onclick=clipImage() value="裁剪图片">
<input type="button" onclick=clearClip() value="不裁剪图片">
</body>
</html>
tente »
estilo Objects