Web design and hosting, database, cloud and social media solutions that deliver business results
  • 商务解决方案
  • 数据库咨询服务
    • 报告
      • Claytabase Server Disk IOPs Calculator
      • SQL代码备份
      • SQL打印机
    • 技术文章
      • SQL-Server
      • SQL Server 2008的维护计划
      • 使用SQL Server函数
      • 使用SQL Server日期
      • 使用SQL Server透视-取消透视
  • 网站设计
    • 怀特岛
    • 技术文章
      • ASP-NET
      • CSS
    • 网站安全
  • 产品展示
  • 社交媒体
  • 关于我们
    • 投资组合
    • 球队
      • 切斯特Copperpot
  • 学院
čeština (CS)Deutsch (DE)English (EN-GB)English (EN-US)Español (ES)Français (FR)हिंदी (HI)italiano (IT)日本語 (JA)polski (PL)Português (PT)русский (RU)Türk (TR)中国的 (ZH)

创建滚动CSS

滚动可以节省很多空间,并且可以非常精细地处理CSS3,再加上CSS Sprite图像的力量和一些数学,我们将把下面的图像转成旋转横幅。
这是我们将用作链接的背景的Sprite。
Social Media sprite image
创建一个这样的旋转横幅。所有链接指向Claytabase社交媒体渠道。

CSS

<style type="text/css">
/*Sprite Backgrounds*/
.smFbk64{background-position: 0px   -0px}
.smTwi64{background-position:-66px  -0px}
.smGoo64{background-position:-132px -0px}
.smLin64{background-position:-198px -0px}
.sm64{width:64px;height:64px;display:inline-block;overflow:hidden;background-image: url('https://www.gsclayton.net/System/Artwork/Articles/SocialMedia_64.png');background-repeat:no-repeat;}
.rnd50{border-radius:50%}
/*Moving Parts*/
.parentDiv{width:64px;height:64px;overflow:hidden;margin:auto}
.followDiv{width:320px;height:64px;position:relative;
animation:followDivSlide ease infinite 10s;-webkit-animation:followDivSlide ease infinite 10s;-moz-animation:followDivSlide ease infinite 10s;
-webkit-animation-fill-mode:forwards;-moz-animation-fill-mode:forwards;animation-fill-mode:forwards;}
@keyframes followDivSlide{from{left:0px;}15%{left:0px;}25%{left:-64px;}40%{left:-64px;}50%{left:-128px;}65%{left:-128px;}75%{left:-192px;}90%{left:-192px;}to{left:-256px;}}
@-webkit-keyframes followDivSlide{from{left:0px;}15%{left:0px;}25%{left:-64px;}40%{left:-64px;}50%{left:-128px;}65%{left:-128px;}75%{left:-192px;}90%{left:-192px;}to{left:-256px;}}
@-moz-keyframes followDivSlide{from{left:0px;}15%{left:0px;}25%{left:-64px;}40%{left:-64px;}50%{left:-128px;}65%{left:-128px;}75%{left:-192px;}90%{left:-192px;}to{left:-256px;}}
</style>
/*HTML*/
<div class="parentDiv">
<
div class="followDiv"><a class="sm64 rnd50 smFbk64" href="https://www.facebook.com/Claytabase"></a><a class="sm64 rnd50 smTwi64" href="https://twitter.com/claytabase"></a><a class="sm64 rnd50 smGoo64" href="https://plus.google.com/+ClaytabaseCoUk"></a><a class="sm64 rnd50 smLin64" href="https://www.linkedin.com/company/claytabase-ltd"></a><a class="sm64 rnd50 smFbk64" href="https://www.facebook.com/Claytabase"></a></div>
</
div>

雪碧

图像是8x64宽,8x64高图像组合为658像素宽和196像素高的图像,我们只对当前的前4个图像感兴趣。
我们为每个CSS创建4个CSS类,以使用速记背景属性创建。
您可以看到图像的每个图像之间的空间为2px,所以我们将其添加到位置-68px等
我们还可以选择2个常用类来使用所有项目,它们设置限制半径和每个项目的大小。

集装箱

这是一个简单的div,与上面定义的图像完全相同的宽度和高度(64x64),我们将溢出设置为隐藏以隐藏小孩的其余部分。
父Div示例

孩子/孩子

这是CSS中移动的第二个div。我们将高度设置为64px,但是这个宽度必须为64px * 4,给我们总共256px。
在这个例子中,我们想要复制第一个Sprite出现在最后,以防止Facebook和Linked In之间突然的混乱,所以调整宽度为320px。

动画

Shema CSS dfilement
我们的动画然后将div移动到0px,-64px,-128px,-192px和-256px的位置,以便在运动期间的任何点只有一个项目可见。请参见下面的示例,无溢出,右侧显示了定位如何移动每个元素。

Author

Helpful?

Please note, this commenting system is still in final testing.
Copyright Claytabase Ltd 2020

Registered in England and Wales 08985867

RSSLoginLink Cookie政策网站地图

Social Media

facebook.com/Claytabaseinstagram.com/claytabase/twitter.com/Claytabaselinkedin.com/company/claytabase-ltd

Get in Touch

+442392064871info@claytabase.comClaytabase Ltd, Unit 3d, Rink Road Industrial Estate, PO33 2LT, United Kingdom
此网站上的设置设置为允许所有Cookie。 这些可以在我们的Cookie政策和设置页面上更改。继续使用本网站即表示您同意使用Cookie。
Ousia Logo
Logout
Ousia CMS Loader