站内搜索:
首页 >> 前端 >> 内容
div

时间:2016/12/8 13:42:12

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="file:///D|/zhandian/jquery-2.1.4/jquery.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").animate({left:'500px'});
});
});


</script>
</head>
<body>
<button>开始动画</button>
<p>默认情况下,所有的 HTML 元素有一个静态的位置,且是不可移动的。
如果需要改变为,我们需要将元素的 position 属性设置为 relative, fixed, 或 absolute!</p>
<p style="background:red; height:100px; width:100px; position:absolute;"></p>
</body>
</html>

  • 上一篇:阻止默认行为(二)
  • 下一篇:03CSS-盒模型和标准文档流(行内元素和块级元素)
  • 返回顶部