怎样用js和css令一个div不停旋转。。求代码。。。

html-css011

怎样用js和css令一个div不停旋转。。求代码。。。,第1张

如果用js控制,需要遍历HTML文档,提取最后的DIV,然后再加样式:

<script type="text/javascript">

$(document).ready(function(){

$("div").last().addClass('highlight') //添加class

$("div").last().css("background", "red")//直接添加样式

})

</script>

如果是css控制,需要在div里面添加class样式,或者写行内样式控制:

<div style="color:red" class="color">内容</div>

<style>

.color{color:red}

</style>

-webkit-transform-origin: center bottom

transform-origin: center bottom

transform-origin:[ <percentage>| <length>| left | center① | right

] [ <percentage>| <length>| top | center② | bottom

]?

默认值:50% 50%,效果等同于center

center

适用于:所有块级元素及某些内联元素

继承性:无

取值:

<percentage>:

用百分比指定坐标值。可以为负值。

<length>:

用长度值指定坐标值。可以为负值。

left:

指定原点的横坐标为left

center①:

指定原点的横坐标为center

right:

指定原点的横坐标为right

top:

指定原点的纵坐标为top

center②:

指定原点的纵坐标为center

bottom:

指定原点的纵坐标为bottom

说明:

设置或检索对象以某个原点进行转换。

该属性提供2个参数值。

如果提供两个,第一个用于横坐标,第二个用于纵坐标。

如果只提供一个,该值将用于横坐标;纵坐标将默认为50%。

对应的脚本特性为transformOrigin。