布局定位

1.①绝对定位(兄弟级)滑动窗口跟着动

<style>

div{width: 200px;height: 200px;position: absolute;}/*绝对定位*/

.green{background-color: green;left: 0;top: 0;z-index: 3;}/*层级定位 z-index的值越大,哪个图层就在上面*/

.red{background-color: red;left: 30;top: 30;z-index: 2;}

</style>

<body>

<div class="green"></div>

<div class="red"></div>

</body>

②.绝对定位(父子级)

<style>

.fu{background-color: green;width: 500px;height: 500px;position: absolute;}/*父辈一定也用定位,无所谓什么定位*/

.zi{background-color: red;width: 200px;height: 200px; position: absolute;right: 0;top: 0;}/*子级用绝对定位*/

</style>

 

<div class="fu">

<div class="zi"></div>

</div>

2.固定定位:固定的,滑动窗口,它也不动(跟小广告一样)

<div style="width: 100px;height: 100px;background-color: yellow;position: fixed;"></div>

关联样式表

Html

<title>无标题文档</title>

<link rel="stylesheet" href="css01.css">/*关联样式表 关联的样式表*/

</head>

 

<body>

<div>01</div>

</body>

Css样式表:在里面写样式,所有的HTML都可以关联它

body{background-color: red;}(css01文件)

 

 

 

 

动画

1.颜色变化

<style>

div{width: 100px;height: 100px;background-color: red;}

@keyframes bianse{

0%{background-color: aqua;}

100%{background-color: yellow;}

}

div{animation: bianse 3s infinite;}/*动画 过渡几秒  自动播放*

</style>

</head>

 

<body>

<div></div>

</body>

2.大小变化

<style>

div{width: 100px;height: 100px;background-color: red;}

@keyframes donghua{

0%{transform: scale(1)}

50%{transform: scale(2)}

100%{transform: scale(1);}

}

div{animation:donghua  3s infinite;}/*动画 过渡几秒  自动播放*

</style>

</head>

 

<body>

<div></div>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值