css-3D基础,动画,媒体,鼠标形状

本文介绍了CSS3中的3D变换,包括transform-origin、transform-style和rotate3d,以及3D平移和景深效果。同时,详细讲解了如何创建和控制CSS动画,包括关键帧动画和动画属性。此外,还提到了CSS变量的使用和媒体查询来实现响应式设计。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

更改变形基点:
/* transform-origin:20px 40px; */
3D旋转
开启3d大舞台 让内部元素保持3D效果
transform-style: preserve-3d;

3d旋转的简写形式 (rotate3d(X,Y,Z,45deg))
      transform: rotate3d(1,1,1,45deg);

3D平移 z轴平移 整数 往外推 负数往内部推
      transform: translateZ(100px);
景深:
表示的意思内部元素全部有景深效果
      perspective: 300px;
动画
定义动画帧
@keyframes animat {
/* 动画开始帧 */
from{
transform: translate(0,0);
}
/* 动画的结束帧 */
to{
transform: translate(600px,0);
}
}
    
      /* 动画的名字(调用动画的地方需要添加) */
/* animation-name:animat; */
/* 动画的时间 */
/* animation-duration: 2s; */
/* 动画的延迟 */
/* animation-delay:3s; */
/* 动画的速度 ease 慢慢加速然后减速 linear 匀速的 steps 步长*/
/* animation-timing-function:steps(4); */
/* 动画结束以后的保持状态 backwards 回到from forwards 动画结束以后停留在to的地方*/
/* animation-fill-mode:forwards; */
/* 动画的执行次数 infinite:无穷*/
/* animation-iteration-count:infinite; */
/* alternate:from-to-from-to reverse:to-from alternate-reverse:to-from-to-from*/
/* animation-direction:alternate-reverse; */

/* 动画简写 */
/* animation:animat 4s 1s infinite alternate linear; */

      动画的播放状态 paused停止动画 running 运行动画
          animation-play-state:paused;


       /* 定义动画帧第二种方式 */
@keyframes animat {

/* 动画第一帧 */
0% {
transform: translate(0, 0);
}

25% {
transform: translate(600px, 0) rotate(90deg) scale(1.3);
}

50% {
transform: translate(600px, 300px) rotate(180deg) scale(1);
}

75% {
transform: translate(0, 300px) rotate(270deg) scale(1.3);
}

/* 动画的结束帧 */
100% {
transform: translate(0, 0) rotate(360deg) scale(1);
}
}
变量
html{
(起名)--mycolor:blue
          }

调用名字
color: var(--mycolor);
计算函数
width: calc(var(--mywidth) * 2 - 100px);
鼠标形状
    cursor 控制鼠标的形状
pointer:手
crosshair:十字架
        not-allowed;不可点击
     /*cursor:pointer;*/
媒体查询
<!-- 引入对应屏幕的css -->
<link rel="stylesheet" media="screen and (max-width:1000px)" href="./index_max1000.css">
<link rel="stylesheet" media="screen and (min-width:1000px)" href="./index_min1000.css">
<link rel="stylesheet" media="screen and (min-width:1200px)" href="./index_min1200.css">
  /* 媒体查询 screen:用于电脑屏幕,平板电脑,智能手机等。*/
/* 表示的意思 当前css只能再最小屏幕为1200的屏幕内起效 */
/* min-width和max-width是包含在内部的 */
  @media screen and (max-width:1200px){
body{
background-color: red;
}
}

不包含的max-width
@media screen and (min-width:1000px) and (max-width:1199px){
body{
background-color: blue;
}
}
@media screen and (max-width:999px){
body{
background-color: yellow;
}
}
裁剪文字背景
-webkit-background-clip:text;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值