CSS3 Loading Bar

特别声明:小站对部分原创文章已开启付费阅读,并开通年费VIP通道,年费价格为 ¥365.00元。如果您喜欢小站的内容,可以点击开通会员进行全站阅读。如果您对付费阅读有任何建议或想法,欢迎发送邮件至: airenliao@gmail.com!(^_^)

CSS3 Loading Bar

CSS3制作一个类似于文件Loading的效果,在这里没有写动画效果,主要考虑文件加载对应的文本,css实现效果会有难度。在这个DEMO中主要运用了四个知识点:第一是google font api,用来制作特殊的英文字体效果;第二个是使用CSS的渐变,制作了渐变的面板效果;第三使用box-shadow,制作面板之类的描边效果;第四就是使用border-radius制作圆角效果。

demodownload

HTML Code:

<div class="loading">
  <h2>Copying</h2>
  <div class="loading-bar">
    <div class="metro"><span></span></div>
    <div class="metro-des">1 MB of 35 MB</div>
  </div>
</div>

CSS Code:

/*loading Bar*/
.loading{
  width: 415px;
  margin: 20px auto;
  border: 1px solid #000;
  border-radius: 5px;
  box-shadow: 0 3px 3px rgba(0,0,0,0.22);
  background-color: rgb(45,42,42); /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzJkMmEyYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzZTNmNDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
  background-image: -moz-linear-gradient(top,  rgba(45,42,42,1) 0%, rgba(62,63,64,1) 100%); /* FF3.6+ */
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(45,42,42,1)), color-stop(100%,rgba(62,63,64,1))); /* Chrome,Safari4+ */
  background-image: -webkit-linear-gradient(top,  rgba(45,42,42,1) 0%,rgba(62,63,64,1) 100%); /* Chrome10+,Safari5.1+ */
  background-image: -o-linear-gradient(top,  rgba(45,42,42,1) 0%,rgba(62,63,64,1) 100%); /* Opera 11.10+ */
  background-image: -ms-linear-gradient(top,  rgba(45,42,42,1) 0%,rgba(62,63,64,1) 100%); /* IE10+ */
  background-image: linear-gradient(to bottom,  rgba(45,42,42,1) 0%,rgba(62,63,64,1) 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2d2a2a', endColorstr='#3e3f40',GradientType=0 ); /* IE6-8 */
}
.loading h2 {
  padding: 5px 10px;
  font-size: 20px;
  text-shadow: -2px -3px 0 rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid black;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.13),inset 0 2px 0 rgba(255,255,255,0.13);
  background-color: rgb(50,50,50); /* Old browsers */
  /* IE9 SVG, needs conditional override of 'filter' to 'none' */
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzMyMzIzMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMyMzIzMjMiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
  background-image: -moz-linear-gradient(top,  rgba(50,50,50,1) 0%, rgba(35,35,35,1) 100%); /* FF3.6+ */
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(50,50,50,1)), color-stop(100%,rgba(35,35,35,1))); /* Chrome,Safari4+ */
  background-image: -webkit-linear-gradient(top,  rgba(50,50,50,1) 0%,rgba(35,35,35,1) 100%); /* Chrome10+,Safari5.1+ */
  background-image: -o-linear-gradient(top,  rgba(50,50,50,1) 0%,rgba(35,35,35,1) 100%); /* Opera 11.10+ */
  background-image: -ms-linear-gradient(top,  rgba(50,50,50,1) 0%,rgba(35,35,35,1) 100%); /* IE10+ */
  background-image: linear-gradient(to bottom,  rgba(50,50,50,1) 0%,rgba(35,35,35,1) 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#323232', endColorstr='#232323',GradientType=0 ); /* IE6-8 */
  border-radius: 5px 5px 0 0;
}
.loading-bar {
  padding: 15px;
}
.metro {
  border: 1px solid #000;
  border-radius: 5px;
  height: 20px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.13);
  margin-bottom: 10px;
  background: #292929;
}
.metro span {
  display: block;
  height: 20px;
  width: 35%;
  border-radius: 5px;
  background-color: rgb(75,117,204); /* Old browsers */
  /* IE9 SVG, needs conditional override of 'filter' to 'none' */
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzRiNzVjYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzRiNzVjYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iIzMwNjFjNCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzMDYxYzQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background-image: -moz-linear-gradient(top,  rgba(75,117,204,1) 0%, rgba(75,117,204,1) 50%, rgba(48,97,196,1) 51%, rgba(48,97,196,1) 100%); /* FF3.6+ */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(75,117,204,1)), color-stop(50%,rgba(75,117,204,1)), color-stop(51%,rgba(48,97,196,1)), color-stop(100%,rgba(48,97,196,1))); /* Chrome,Safari4+ */
  background-image: -webkit-linear-gradient(top,  rgba(75,117,204,1) 0%,rgba(75,117,204,1) 50%,rgba(48,97,196,1) 51%,rgba(48,97,196,1) 100%); /* Chrome10+,Safari5.1+ */
  background-image: -o-linear-gradient(top,  rgba(75,117,204,1) 0%,rgba(75,117,204,1) 50%,rgba(48,97,196,1) 51%,rgba(48,97,196,1) 100%); /* Opera 11.10+ */
  background-image: -ms-linear-gradient(top,  rgba(75,117,204,1) 0%,rgba(75,117,204,1) 50%,rgba(48,97,196,1) 51%,rgba(48,97,196,1) 100%); /* IE10+ */
  background-image: linear-gradient(to bottom,  rgba(75,117,204,1) 0%,rgba(75,117,204,1) 50%,rgba(48,97,196,1) 51%,rgba(48,97,196,1) 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4b75cc', endColorstr='#3061c4',GradientType=0 ); /* IE6-8 */
}
.metro-des {
  color: #a49f9f;
  text-shadow: -1px -2px 0 rgba(0, 0, 0, 0.3);
}

demodownload

如需转载,烦请注明出处:http://www.w3cplus.com/demo/css3-loading-bar.html

Jordan Flight Luxe

如需转载,烦请注明出处:https://www.w3cplus.com/demo/436.html

如果文章中有不对之处,烦请各位大神拍正。如果你觉得这篇文章对你有所帮助,打个赏,让我有更大的动力去创作。(^_^)。看完了?还不过瘾?点击向作者提问!

赏杯咖啡,鼓励他创作更多优质内容!
返回顶部