10+个让你的项目大放异彩的CSS loading加载特效,快来收藏吧!!

本篇文章给大家分享10+个loading加载特效,保证让你的项目大放异彩,希望对大家有所帮助,快来收藏吧!!

10+个让你的项目大放异彩的CSS loading加载特效,快来收藏吧!!

相信大家经常会使用到加载动画,但是大部分组件库的加载样式都太简洁了。

这次给前端工友们收集了10+个高逼格加载动画效果!!复制就能直接用!!

来吧展示

1、一个”滚动”加载

跳动旋转的的方块再加上渐变的影子简单的构成了一个物体滚动的画面

立即学习“前端免费学习笔记(深入)”;

1.gif

/* loading.css */.boxLoading {    width: 50px;  height: 50px;  margin: auto;  position: absolute;  left: 0;  right: 0;  top: 0;  bottom: 0;}.boxLoading:before {  content: '';  width: 50px;  height: 5px;  background: #fff;  opacity: 0.7;  position: absolute;  top: 59px;  left: 0;  border-radius: 50%;  animation: shadow .5s linear infinite;}.boxLoading:after {  content: '';  width: 50px;  height: 50px;  background: #e04960;  animation: animate .5s linear infinite;  position: absolute;  top: 0;  left: 0;  border-radius: 3px;}@keyframes animate {  17% {    border-bottom-right-radius: 3px;  }  25% {    transform: translateY(9px) rotate(22.5deg);  }  50% {    transform: translateY(18px) scale(1, .9) rotate(45deg);    border-bottom-right-radius: 40px;  }  75% {    transform: translateY(9px) rotate(67.5deg);  }  100% {    transform: translateY(0) rotate(90deg);  }}@keyframes shadow {  0%, 100% {    transform: scale(1, 1);  }  50% {    transform: scale(1.2, 1);  }}

Author:Dicson

2、一个”方块消失术”加载

当每个消失的方块集成一起再设置不同的消失时间会发生什么事情呢?

2.gif

/* loading.css */.sk-cube-grid {  width: 4em;  height: 4em;  margin: auto; }.sk-cube {  width: 33%;  height: 33%;  background-color: #e04960;  float: left;  animation: sk-cube-grid-scale-delay 1.3s infinite ease-in-out;}.sk-cube-1 {  animation-delay: 0.2s;}.sk-cube-2 {  animation-delay: 0.3s;}.sk-cube-3 {  animation-delay: 0.4s;}.sk-cube-4 {  animation-delay: 0.1s;}.sk-cube-5 {  animation-delay: 0.2s;}.sk-cube-6 {  animation-delay: 0.3s;}.sk-cube-7 {  animation-delay: 0s;}.sk-cube-8 {  animation-delay: 0.1s;}.sk-cube-9 {  animation-delay: 0.2s;}@keyframes sk-cube-grid-scale-delay {  0%, 70%, 100% {    transform: scale3D(1,1,1);  }  35%           {    transform: scale3D(0,0,1);  }}

Author:Nicola Pressi

3、一个”无敌风火镰”加载

四个镰刀来回劈斩会形成一个什么现象呢?

3.gif

/* loading.css */.spinner {  position: absolute;  width: 128px;  height: 128px;  top: calc(50% - 64px);  left: calc(50% - 64px);  transform: perspective(206px) rotateX(45deg);}.outer {  box-sizing: border-box;  animation: spin 3s linear infinite;  height: 100%;}.inner {  position: absolute;  border-radius: 50%;  width: 64px;  height: 64px;  animation: spin 1.8s ease-in-out infinite;}.inner.tl {  top: 0;  left: 0;  border-top: 2px solid #531430;  border-left: 4px solid #531430;}.inner.tr {  top: 0;  right: 0;  border-top: 2px solid #e04960;  border-right: 4px solid #e04960;}.inner.br {  bottom: 0;  right: 0;  border-bottom: 2px solid #531430;  border-right: 4px solid #531430;}.inner.bl {  bottom: 0;  left: 0;  border-bottom: 2px solid #e04960;  border-left: 4px solid #e04960;}@keyframes spin {  0% {    transform: rotate(0deg);  }  100% {    transform: rotate(360deg);  }}

Author:Martin van Driel

4、一个”填充”加载

简单的正方形旋转再加上内部的高度控制即可实现填充效果喔~

4.gif

  
/* loading.css */.loading {  display: inline-block;  width: 30px;  height: 30px;  position: relative;  border: 4px solid #e04960;  animation: loader 4s infinite ease;}.loading-inner {  vertical-align: top;  display: inline-block;  width: 100%;  background-color: #e04960;  animation: loader-inner 4s infinite ease-in;}@keyframes loader {  0% {    transform: rotate(0deg);  }  25% {    transform: rotate(180deg);  }  50% {    transform: rotate(180deg);  }  75% {    transform: rotate(360deg);  }  100% {    transform: rotate(360deg);  }}@keyframes loader-inner {  0% {    height: 0%;  }    25% {    height: 0%;  }  50% {    height: 100%;  }  75% {    height: 100%;  }   100% {    height: 0%;  }}

Author:Josh

5、一个”音浪”加载

1个元素缩放很简陋,那15个会发生什么?

5.gif

/* loading.css */.loader {  position: absolute;  top: 0px;  bottom: 0px;  left: 0px;  right: 0px;  margin: auto;  width: 175px;  height: 100px;}.loader span {  display: block;  background: #e04960;  width: 7px;  height: 100%;  border-radius: 14px;  margin-right: 5px;  float: left;}.loader span:last-child {  margin-right: 0px;}.loader span:nth-child(1) {  animation: load 2.5s 1.4s infinite linear;}.loader span:nth-child(2) {  animation: load 2.5s 1.2s infinite linear;}.loader span:nth-child(3) {  animation: load 2.5s 1s infinite linear;}.loader span:nth-child(4) {  animation: load 2.5s 0.8s infinite linear;}.loader span:nth-child(5) {  animation: load 2.5s 0.6s infinite linear;}.loader span:nth-child(6) {  animation: load 2.5s 0.4s infinite linear;}.loader span:nth-child(7) {  animation: load 2.5s 0.2s infinite linear;}.loader span:nth-child(8) {  animation: load 2.5s 0s infinite linear;}.loader span:nth-child(9) {  animation: load 2.5s 0.2s infinite linear;}.loader span:nth-child(10) {  animation: load 2.5s 0.4s infinite linear;}.loader span:nth-child(11) {  animation: load 2.5s 0.6s infinite linear;}.loader span:nth-child(12) {  animation: load 2.5s 0.8s infinite linear;}.loader span:nth-child(13) {  animation: load 2.5s 1s infinite linear;}.loader span:nth-child(14) {  animation: load 2.5s 1.2s infinite linear;}.loader span:nth-child(15) {  animation: load 2.5s 1.4s infinite linear;}@keyframes load {  0% {    background: #531430;    transform: scaleY(0.08);  }  50% {    background: #e04960;           transform: scaleY(1);  }  100% {    background: #531430;        transform: scaleY(0.08);  }}

Author:Dicson

6、一个”声浪”加载

元素透明度与高度的配合也能做别具一格的效果

6.gif

/* loading.css */.bars {  height: 30px;  left: 50%;  margin: -30px 0 0 -20px;  position: absolute;  top: 60%;  width: 40px;}.bar { background: #e04960;  bottom: 1px;  height: 3px;  position: absolute;  width: 3px;        animation: sound 0ms -800ms linear infinite alternate;}@keyframes sound {  0% {     opacity: .35;      height: 3px;   }  100% {      opacity: 1;             height: 28px;          }}.bar:nth-child(1)  { left: 1px; animation-duration: 474ms; }.bar:nth-child(2)  { left: 5px; animation-duration: 433ms; }.bar:nth-child(3)  { left: 9px; animation-duration: 407ms; }.bar:nth-child(4)  { left: 13px; animation-duration: 458ms; }.bar:nth-child(5)  { left: 17px; animation-duration: 400ms; }.bar:nth-child(6)  { left: 21px; animation-duration: 427ms; }.bar:nth-child(7)  { left: 25px; animation-duration: 441ms; }.bar:nth-child(8)  { left: 29px; animation-duration: 419ms; }.bar:nth-child(9)  { left: 33px; animation-duration: 487ms; }.bar:nth-child(10) { left: 37px; animation-duration: 442ms; }

Author:El Alemaño

7、一个”无敌风火圆”加载

4个圆居然能做出相对排斥的效果?

7.gif

/* loading.css */.loading {  position: absolute;  top: calc(50% - 24px);  left: calc(50% - 24px);  width: 48px;  height: 48px;  border-radius: 50%;  transform: perspective( 128px ) rotateX( 30deg );}.inner {  position: absolute;  box-sizing: border-box;  width: 16px;  height: 16px;  background-color: #e04960;  border-radius: 50%;}.inner.one {  left: 0%;  top: 0%;  animation: move-right 1s ease-out infinite;}.inner.two {  right: 0%;  top: 0%;  animation: move-down 1s ease-in-out infinite;}.inner.three {  right: 0%;  bottom: 0%;  animation: move-left 1s ease-in-out infinite;}.inner.four {  left: 0%;  bottom: 0%;  animation: move-up 1s ease-out infinite;}@keyframes move-right {  0% {    transform: translateX(0);  }  100% {    transform: translateX(32px);  }}@keyframes move-down {  0% {    transform: translateY();  }  100% {    transform: translateY(32px);  }}@keyframes move-left {  0% {    transform: translateX(0);  }  100% {    transform: translateX(-32px);  }}@keyframes move-up {  0% {    transform: translateY(0);  }  100% {    transform: translateY(-32px);  }}

Author:Martin van Driel

8、一个”弹珠”加载

一个个的小弹珠来回移动居然也能描绘出如此美妙的画面

8.gif

/* loading.css */.container {    width: 200px;    height: 100px;    margin: 0 auto;}.ball {    width: 10px;    height: 10px;    margin: 10px auto;    border-radius: 50px;}.ball:nth-child(1) {    background: #e04960;    -webkit-animation: right 1s infinite ease-in-out;    -moz-animation: right 1s infinite ease-in-out;    animation: right 1s infinite ease-in-out;}.ball:nth-child(2) {    background: #e04960;    -webkit-animation: left 1.1s infinite ease-in-out;    -moz-animation: left 1.1s infinite ease-in-out;    animation: left 1.1s infinite ease-in-out;}.ball:nth-child(3) {    background: #e04960;    -webkit-animation: right 1.05s infinite ease-in-out;    -moz-animation: right 1.05s infinite ease-in-out;    animation: right 1.05s infinite ease-in-out;}.ball:nth-child(4) {    background: #e04960;    -webkit-animation: left 1.15s infinite ease-in-out;    -moz-animation: left 1.15s infinite ease-in-out;    animation: left 1.15s infinite ease-in-out;}.ball:nth-child(5) {    background: #e04960;    -webkit-animation: right 1.1s infinite ease-in-out;    -moz-animation: right 1.1s infinite ease-in-out;    animation: right 1.1s infinite ease-in-out;}.ball:nth-child(6) {    background: #e04960;    -webkit-animation: left 1.05s infinite ease-in-out;    -moz-animation: left 1.05s infinite ease-in-out;    animation: left 1.05s infinite ease-in-out;}.ball:nth-child(7) {    background: #e04960;    -webkit-animation: right 1s infinite ease-in-out;    -moz-animation: right 1s infinite ease-in-out;    animation: right 1s infinite ease-in-out;}@-webkit-keyframes right {    0% {            -webkit-transform: translate(-15px);    }    50% {            -webkit-transform: translate(15px);    }    100% {            -webkit-transform: translate(-15px);    }}@-webkit-keyframes left {    0% {            -webkit-transform: translate(15px);    }    50% {            -webkit-transform: translate(-15px);    }    100% {            -webkit-transform: translate(15px);    }}@-moz-keyframes right {    0% {            -moz-transform: translate(-15px);    }    50% {            -moz-transform: translate(15px);    }    100% {            -moz-transform: translate(-15px);    }}@-moz-keyframes left {    0% {            -moz-transform: translate(15px);    }    50% {            -moz-transform: translate(-15px);    }    100% {            -moz-transform: translate(15px);    }}@keyframes right {    0% {            transform: translate(-15px);    }    50% {            transform: translate(15px);    }    100% {            transform: translate(-15px);    }}@keyframes left {    0% {            transform: translate(15px);    }    50% {            transform: translate(-15px);    }    100% {            transform: translate(15px);    }}

Author:Richie

9、一个”胶粘”加载

每个圆进行粘合拆分形成了一个胶粘效果

9.gif

/* loading.css */.loading {  width: 166px;  height: 166px;  position: absolute;  left: 50%;  top: 50%;  transform: translate(-50%, -50%);  -webkit-filter: url("#goo");  filter: url("#goo");}.loading span {  width: 100%;  text-align: center;  color: #e04960;  font-weight: bold;  text-transform: uppercase;  font-size: 15px;  letter-spacing: 1px;  position: absolute;  left: 1px;  top: 46%;}.loading:before, .loading:after {  content: '';  border-radius: 50%;  background-color: #e04960;  width: 26px;  height: 26px;  position: absolute;  left: 72px;  top: 8px;  animation: rotate 6s linear;  animation-iteration-count: infinite;  transform-origin: 12px 76px;}.loading:before {  box-shadow: 45px 19px 0px 0px #e04960, 62px 63px 0px 0px #e04960, 45px 107px 0px 0px #e04960, 0px 126px 0px 0px #e04960, -46px 107px 0px 0px #e04960, -63px 63px 0px 0px #e04960, -46px 19px 0px 0px #e04960;}.loading:after {  animation-direction: reverse;}@keyframes rotate {0% { transform: rotate(0deg); }100% { transform: rotate(-360deg); }}

Author:Dicson

10、一个”方块对对碰”加载

巧妙的运用位移也能做出碰撞挤出的效果

10.gif

/* loading.css */.loader {  display: block;  position: relative;  height: 20px;  width: 86px;}.loading-square {  position: absolute;  height: 20px;  width: 20px;  top: 0;}.loading-square:nth-child(1) {  left: 0;  animation: square1 1.5s linear forwards infinite;}.loading-square:nth-child(2) {  left: 22px;  animation: square2 1.5s linear forwards infinite;}.loading-square:nth-child(3) {  left: 44px;  animation: square3 1.5s linear forwards infinite;}.loading-square:nth-child(4) {  left: 66px;  animation: square4 1.5s linear forwards infinite;}@keyframes square1 {  0% {    background-color: #97c900;    transform: translate(0, 0);  }  9.09091% {    transform: translate(0, calc(-100% - 2px));    background-color: #97c900;  }  18.18182% {    transform: translate(calc(100% + 2px), calc(-100% - 2px));    background-color: #15668a;  }  27.27273% {    transform: translate(calc(100% + 2px), 0);  }  100% {    background-color: #15668a;    transform: translate(calc(100% + 2px), 0);  }}@keyframes square2 {  0% {    background-color: #15668a;    transform: translate(0, 0);  }  18.18182% {    transform: translate(0, 0);  }  27.27273% {    transform: translate(0, calc(100% + 2px));    background-color: #15668a;  }  36.36364% {    transform: translate(calc(100% + 2px), calc(100% + 2px));    background-color: #D53A33;  }  45.45455% {    transform: translate(calc(100% + 2px), 0);  }  100% {    background-color: #D53A33;    transform: translate(calc(100% + 2px), 0);  }}@keyframes square3 {  0% {    background-color: #D53A33;    transform: translate(0, 0);  }  36.36364% {    transform: translate(0, 0);  }  45.45455% {    transform: translate(0, calc(-100% - 2px));    background-color: #D53A33;  }  54.54545% {    transform: translate(calc(100% + 2px), calc(-100% - 2px));    background-color: #E79C10;  }  63.63636% {    transform: translate(calc(100% + 2px), 0);  }  100% {    background-color: #E79C10;    transform: translate(calc(100% + 2px), 0);  }}@keyframes square4 {  0% {    transform: translate(0, 0);    background-color: #E79C10;  }  54.54545% {    transform: translate(0, 0);  }  63.63636% {    transform: translate(0, calc(100% + 2px));    background-color: #E79C10;  }  72.72727% {    background-color: #D53A33;  }  81.81818% {    background-color: #15668a;  }  90.90909% {    transform: translate(calc(-300% - 6px), calc(100% + 2px));    background-color: #97c900;  }  100% {    transform: translate(calc(-300% - 6px), 0);    background-color: #97c900;  }}

Author:Paul Grant

11、一个”Switch”加载

有Switch的同学应该很熟悉了,这就是eshop里面的加载

11.gif

/* loading.css */.load{  width: 400px;  height: 170px;}@keyframes loader {  0%{    background: #FF8919;    width:0%;  }20%{    width:100%;  }39%{    background: #FF8919;  }40%{    background: #FFA54F;    width: 0%  }60%{    width: 100%;  }80%{    width:0%;  }100%{    background: #FFA54F;    width: 0%;  }}@keyframes loaderAlt {  0%{    background: #FF7C00;    width:100%;  }19%{    background: #FF7C00;  }20%{    background: #FF9834;    width: 0%;  }40%{    width: 100%;  }59%{    background: #FF9834;  }60%{    background: #FF7C00;    width: 0;  }80%{    width: 100%;  }100%{    background: #FF7C00;    width: 100%  }}.loading{  display: flex;  flex-direction: column;  height: 100%;  position: relative;  width: 100%;}.loader__bar{  display: flex;  flex: 1;  position: relative;  width: 100%;}.loader__bar:before{  animation: loader ease 8s infinite;  animation-delay: 100ms;  background: #FF7C00;  background-size: 200% 200%;  content: "";  height:100%;  width: 0%;}.loader__bar:after{  animation: loaderAlt ease 8s infinite;  animation-delay: 100ms;  background: #FF7C00;  background-size: 200% 200%;  content: "";  height: 100%;  width: 100%;}.loader__bar--delay-1:before,.loader__bar--delay-1:after{  animation-delay: 200ms;}.loader__bar--delay-2:before,.loader__bar--delay-2:after{  animation-delay: 300ms;}.loader__bar--delay-3:before,.loader__bar--delay-3:after{  animation-delay: 400ms;}.loader__bar--delay-4:before,.loader__bar--delay-4:after{  animation-delay: 500ms;}.loader__bar--delay-5:before,.loader__bar--delay-5:after{  animation-delay: 600ms;}

Author:Steve Meredith

更多编程相关知识,请访问:编程入门!!

以上就是10+个让你的项目大放异彩的CSS loading加载特效,快来收藏吧!!的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1621885.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月24日 07:40:08
下一篇 2025年12月24日 07:40:31

相关推荐

  • CSS mask属性无法获取图片:为什么我的图片不见了?

    CSS mask属性无法获取图片 在使用CSS mask属性时,可能会遇到无法获取指定照片的情况。这个问题通常表现为: 网络面板中没有请求图片:尽管CSS代码中指定了图片地址,但网络面板中却找不到图片的请求记录。 问题原因: 此问题的可能原因是浏览器的兼容性问题。某些较旧版本的浏览器可能不支持CSS…

    2025年12月24日
    900
  • 如何用dom2img解决网页打印样式不显示的问题?

    用dom2img解决网页打印样式不显示的问题 想将网页以所见即打印的的效果呈现,需要采取一些措施,特别是在使用了bootstrap等大量采用外部css样式的框架时。 问题根源 在常规打印操作中,浏览器通常会忽略css样式等非必要的页面元素,导致打印出的结果与网页显示效果不一致。这是因为打印机制只识别…

    2025年12月24日
    800
  • 如何用 CSS 模拟不影响其他元素的链接移入效果?

    如何模拟 css 中链接的移入效果 在 css 中,模拟移入到指定链接的效果尤为复杂,因为链接的移入效果不影响其他元素。要实现这种效果,最简单的方法是利用放大,例如使用 scale 或 transform 元素的 scale 属性。下面提供两种方法: scale 属性: .goods-item:ho…

    2025年12月24日
    700
  • Uniapp 中如何不拉伸不裁剪地展示图片?

    灵活展示图片:如何不拉伸不裁剪 在界面设计中,常常需要以原尺寸展示用户上传的图片。本文将介绍一种在 uniapp 框架中实现该功能的简单方法。 对于不同尺寸的图片,可以采用以下处理方式: 极端宽高比:撑满屏幕宽度或高度,再等比缩放居中。非极端宽高比:居中显示,若能撑满则撑满。 然而,如果需要不拉伸不…

    2025年12月24日
    400
  • PC端H5项目如何实现适配:流式布局、响应式设计和两套样式?

    PC端的适配方案及PC与H5兼顾的实现方案探讨 在开发H5项目时,常用的屏幕适配方案是postcss-pxtorem或postcss-px-to-viewport,通常基于iPhone 6标准作为设计稿。但对于PC端网项目,处理不同屏幕大小需要其他方案。 PC端屏幕适配方案 PC端屏幕适配一般采用流…

    2025年12月24日
    300
  • CSS 元素设置 10em 和 transition 后为何没有放大效果?

    CSS 元素设置 10em 和 transition 后为何无放大效果? 你尝试设置了一个 .box 类,其中包含字体大小为 10em 和过渡持续时间为 2 秒的文本。当你载入到页面时,它没有像 YouTube 视频中那样产生放大效果。 原因可能在于你将 CSS 直接写在页面中 在你的代码示例中,C…

    2025年12月24日
    400
  • 如何实现类似横向U型步骤条的组件?

    横向U型步骤条寻求替代品 希望找到类似横向U型步骤条的组件或 CSS 实现。 潜在解决方案 根据给出的参考图片,类似的组件有: 图片所示组件:图片提供了组件的外观,但没有提供具体的实现方式。参考链接:提供的链接指向了 SegmentFault 上的另一个问题,其中可能包含相关的讨论或解决方案建议。 …

    2025年12月24日
    800
  • 如何让小说网站控制台显示乱码,同时网页内容正常显示?

    如何在不影响用户界面的情况下实现控制台乱码? 当在小说网站上下载小说时,大家可能会遇到一个问题:网站上的文本在网页内正常显示,但是在控制台中却是乱码。如何实现此类操作,从而在不影响用户界面(UI)的情况下保持控制台乱码呢? 答案在于使用自定义字体。网站可以通过在服务器端配置自定义字体,并通过在客户端…

    2025年12月24日
    800
  • 如何优化CSS Grid布局中子元素排列和宽度问题?

    css grid布局中的优化问题 在使用css grid布局时可能会遇到以下问题: 问题1:无法控制box1中li的布局 box1设置了grid-template-columns: repeat(auto-fill, 20%),这意味着容器将自动填充尽可能多的20%宽度的列。当li数量大于5时,它们…

    2025年12月24日
    800
  • SASS 中的 Mixins

    mixin 是 css 预处理器提供的工具,虽然它们不是可以被理解的函数,但它们的主要用途是重用代码。 不止一次,我们需要创建多个类来执行相同的操作,但更改单个值,例如字体大小的多个类。 .fs-10 { font-size: 10px;}.fs-20 { font-size: 20px;}.fs-…

    2025年12月24日
    000
  • 如何在地图上轻松创建气泡信息框?

    地图上气泡信息框的巧妙生成 地图上气泡信息框是一种常用的交互功能,它简便易用,能够为用户提供额外信息。本文将探讨如何借助地图库的功能轻松创建这一功能。 利用地图库的原生功能 大多数地图库,如高德地图,都提供了现成的信息窗体和右键菜单功能。这些功能可以通过以下途径实现: 高德地图 JS API 参考文…

    2025年12月24日
    400
  • 如何使用 scroll-behavior 属性实现元素scrollLeft变化时的平滑动画?

    如何实现元素scrollleft变化时的平滑动画效果? 在许多网页应用中,滚动容器的水平滚动条(scrollleft)需要频繁使用。为了让滚动动作更加自然,你希望给scrollleft的变化添加动画效果。 解决方案:scroll-behavior 属性 要实现scrollleft变化时的平滑动画效果…

    2025年12月24日
    000
  • CSS mask 属性无法加载图片:浏览器问题还是代码错误?

    CSS mask 属性请求图片失败 在使用 CSS mask 属性时,您遇到了一个问题,即图片没有被请求获取。这可能是由于以下原因: 浏览器问题:某些浏览器可能在处理 mask 属性时存在 bug。尝试更新到浏览器的最新版本。代码示例中的其他信息:您提供的代码示例中还包含其他 HTML 和 CSS …

    2025年12月24日
    000
  • 如何为滚动元素添加平滑过渡,使滚动条滑动时更自然流畅?

    给滚动元素平滑过渡 如何在滚动条属性(scrollleft)发生改变时为元素添加平滑的过渡效果? 解决方案:scroll-behavior 属性 为滚动容器设置 scroll-behavior 属性可以实现平滑滚动。 html 代码: click the button to slide right!…

    2025年12月24日
    500
  • 如何用 CSS 实现链接移入效果?

    css 中实现链接移入效果的技巧 在 css 中模拟链接的移入效果可能并不容易,因为它们不会影响周围元素。但是,有几个方法可以实现类似的效果: 1. 缩放 最简单的方法是使用 scale 属性,它会放大元素。以下是一个示例: 立即学习“前端免费学习笔记(深入)”; .goods-item:hover…

    2025年12月24日
    000
  • 网页使用本地字体:为什么 CSS 代码中明明指定了“荆南麦圆体”,页面却仍然显示“微软雅黑”?

    网页中使用本地字体 本文将解答如何将本地安装字体应用到网页中,避免使用 src 属性直接引入字体文件。 问题: 想要在网页上使用已安装的“荆南麦圆体”字体,但 css 代码中将其置于第一位的“font-family”属性,页面仍显示“微软雅黑”字体。 立即学习“前端免费学习笔记(深入)”; 答案: …

    2025年12月24日
    000
  • 如何选择元素个数不固定的指定类名子元素?

    灵活选择元素个数不固定的指定类名子元素 在网页布局中,有时需要选择特定类名的子元素,但这些元素的数量并不固定。例如,下面这段 html 代码中,activebar 和 item 元素的数量均不固定: *n *n 如果需要选择第一个 item元素,可以使用 css 选择器 :nth-child()。该…

    2025年12月24日
    200
  • 如何用 CSS 实现类似卡券的缺口效果?

    类似卡券的布局如何实现 想要实现类似卡券的布局,可以使用遮罩(mask)来实现缺口效果。 示例代码: .card { -webkit-mask: radial-gradient(circle at 20px, #0000 20px, red 0) -20px;} 效果: 立即学习“前端免费学习笔记(…

    2025年12月24日
    000
  • 如何用纯代码实现自定义宽度和间距的虚线边框?

    自定义宽度和间距的虚线边框 提问: 如何创建一个自定义宽度和间距的虚线边框,如下图所示: 元素宽度:8px元素高度:1px间距:2px圆角:4px 解答: 传统的解决方案通常涉及使用 border-image 引入切片的图片来实现。但是,这需要引入外部资源。本解答将提供一种纯代码的方法,使用 svg…

    2025年12月24日
    000
  • PC端、PC兼响应式H5项目,如何选择最佳适配方案?

    多屏适配:PC端、PC兼响应式H5项目解决方案 针对PC端的网页适配,业界普遍采用以下方案: 流媒体查询:根据设备屏幕宽度应用不同的样式表,实现不同屏幕尺寸的适配。栅格系统:将布局划分为多个网格,根据屏幕宽度调整网格的显示和隐藏,实现自适应布局。 一般情况下,设计师设计PC页面时,会以特定像素宽度为…

    2025年12月24日
    000

发表回复

登录后才能评论
关注微信