HTML DOM clip ÊôÐÔ

HTML DOM Style ¶ÔÏó

¶¨ÒåºÍÓ÷¨

clip ÊôÐÔÉèÖÃÔªËØµÄÐÎ×´¡£

µ±Í¼Ïñ´óÓÚËüËùÔÚµÄÔªËØÊ±»á·¢Éúʲô£¿"clip" ÊôÐÔÔÊÐíÄã¹æ¶¨ÔªËصĿɼû³ß´ç£¬ÒÔ¼°ÔªËر»²Ã¼ôºÍÏÔʾµÄÐÎ×´¡£

Óï·¨£º

Object.style.clip=rect(top,right,bottom,left)|auto

¿ÉÄܵÄÖµ

Öµ ÃèÊö
rect(top,right,bottom,left) ÉèÖÃÔªËØµÄÐÎ×´¡£
auto ä¯ÀÀÆ÷ÉèÖÃÔªËØµÄÐÎ×´¡£

ÌáʾºÍ×¢ÊÍ

×¢ÊÍ£º¸ÃÊôÐÔ²»ÄÜÓÃÓÚ "overflow" ÉèÖÃΪ "visible" µÄÔªËØ¡£

ʵÀý

±¾Àý°ÑͼÏñ²Ã¼ôΪָ¶¨µÄÐÎ×´£º

<html>
<head>
<style type="text/css">
img
{
position:absolute;
top:100px;
}
</style>
<script type="text/javascript">
function clipImage()
{
document.getElementById("img1").style.clip="rect(0px,50px,50px,0px)";
}
</script>
</head>
<body>

<img id="img1" border="0" src="logocss.gif" width="95" height="84" />

<input type="button" onclick=clipImage() value="Clip image" />

</body>
</html>

HTML DOM Style ¶ÔÏó

VUE