HTML DOM backgroundPositionY ÊôÐÔ

HTML DOM Style ¶ÔÏó

¶¨ÒåºÍÓ÷¨

backgroundPositionY ÊôÐÔÉèÖà background-image µÄ´¹Ö±Î»Öá£

Óï·¨£º

Object.style.backgroundPositionY=position
²ÎÊý ÃèÊö
  • top
  • center
  • bottom
´¹Ö±Î»Öá£
y% ´¹Ö±Î»Öá£Top ÊÇ 0%¡£Bottom ÊÇ 100%
ypos ´¹Ö±Î»Öá£Top ÊÇ 0¡£µ¥Î»ÊÇÏñËØ (0px) »òÆäËû CSS µ¥Î»¡£

ʵÀý

ÏÂÃæµÄÀý×Ӹıä background-image µÄ´¹Ö±Î»Öãº

<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.jpg);
background-repeat:no-repeat
}
</style>
<script type="text/javascript">
function changePosition()
{
document.body.style.backgroundPositionY="bottom";
}
</script>
</head>
<body>

<input type="button" onclick="changePosition()"
value="Change background-image's y-position" />

</body>
</html>

HTML DOM Style ¶ÔÏó

VUE