纯CSS3打造自行车

 废话不想多说,我们直接上图和代码最实际。

 我们先来看看效果图吧,看了效果图之后你们就会有动力去打造属于你们自己的自行车啦

 

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

a6d50f35b586894d7e10eb9e1fea2ae.png

 

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

  怎么样,帅不帅呀,快来打造帅帅的自行车吧

  代码如下,复制即可用,不过这是我的自行车,你们可不能盗取我的自行车哦

                    快来打造属于你们自己的自行车吧                    * {                margin: 0;                padding: 0            }                        ol,            ul {                list-style: none/*去掉圆点或数字*/            }                        .cycle-outer {                width: 534px;                height: 260px;                position: absolute;                /*绝对定位*/                top: 50%;                /*距离顶部*/                margin: -160px 0 0 -267px;                /*距离外边距*/                left: 50%;            }                        .cycle-wrapper {                width: 534px;                height: 260px;                margin: 0 auto;                position: relative;                /*相对定位*/            }                        .cycle-wheel-front {                /*前轮*/                margin: 100px 0 0 330px;            }                        .cycle-wheel-back {                /*后轮*/                margin: 100px 0 0 0px;            }                        .cycle-wheel-outer {                background: transparent;                border: 5px solid #aaa;                border-radius: 50%;                /*画外轮圆圈*/                width: 190px;                height: 190px;                position: absolute;                margin-top: 5px;                animation: wheel-rotate 2s linear infinite;                /*定义动画*/            }            /*轮胎开始旋转*/            @keyframes wheel-rotate {                from {                    transform: rotate(0deg);                }                to {                    transform: rotate(360deg);                }            }                        .cycle-wheel-outer:after {                /*插入内轮胎圆圈*/                background: transparent;                border: 4px solid #EF9058;                border-radius: 50%;                width: 176px;                height: 176px;                position: absolute;                margin: 3px;                content: "";            }                        .spoke {                /*开始画车轮线条*/                position: absolute;                width: 1px;                height: 200px;                background: #ccc;                margin: -5px 0 0 95px;                z-index: 0;            }                        .spoke:after {                /*在后面插入两条*/                content: "";                position: absolute;                width: 1px;                height: 200px;                background: #ccc;                transform: rotate(120deg);            }                        .spoke:before {                /*在前面插入两条*/                content: "";                position: absolute;                width: 1px;                height: 200px;                background: #ccc;                transform: rotate(240deg);            }            /*轮胎线条完成*/                        .spoke-container li:nth-child(2) {                /*中心点旋转*/                transform: rotate(30deg);            }                        .inner-disc {                /*画中心轴圆点*/                background: #666;                width: 20px;                height: 20px;                border-radius: 50%;                position: absolute;                left: 50%;                margin: -10px 0 0 -10px;                top: 50%;            }                        .inner-disc-2 {                /*画轮胎中心轴的圆圈*/                background: transparent;                width: 6px;                height: 6px;                border: 2px solid #FFF;                border-radius: 50%;                position: absolute;                left: 50%;                margin: -5px 0 0 -5px;                top: 50%;            }                        .cycle-wheel-back .inner-disc-2:after {                /*插入后轮轴心齿轮*/                content: "";                background: transparent;                width: 18px;                height: 18px;                border-radius: 50%;                position: absolute;                left: 50%;                margin: -13px 0 0 -13px;                top: 50%;                border: 4px dotted #666;            }            .cycle-body {                margin-left: 125px;            }            .front-wheel-frame {/*前叉*/                background: #5E999B;                width: 8px;                height: 180px;                position: absolute;                z-index: 2;                transform: rotate(-25deg);                margin: -72px 0 0 260px;            }            .top-frame {/*上管*/                background: #5E999B;                width: 180px;                height: 8px;                position: absolute;                z-index: 2;                margin: -20px 0 0 62px;                transform: rotate(-8deg);            }            .front-frame {/*下管*/                background: #5E999B;                width: 8px;                height: 160px;                position: absolute;                z-index: 2;                transform: rotate(41deg);                margin: -36px 0 0 189px;            }            .center-frame { /*坐杆*/                background: #5E999B;                width: 8px;                height: 205px;                position: absolute;                z-index: 2;                transform: rotate(-33deg);                margin: -84px 0 0 75px;            }            .back-frame {/*后管*/                background: #5E999B;                width: 8px;                height: 136px;                position: absolute;                z-index: 2;                transform: rotate(39deg);                margin: -23px 0 0 19px;            }            .bottom-frame {/*后叉or平管*/                background: #5E999B;                width: 159px;                height: 8px;                position: absolute;                z-index: 2;                margin: 100px 0 0 -16px;            }            .handlebar-front {/*车把*/                width: 60px;                height: 8px;                background: #5E999B;                z-index: 2;                position: absolute;                margin: -68px 0 0 222px;                border-top-left-radius: 3px;                border-bottom-left-radius: 3px;            }            .handlebar-curve {/*车把手*/                width: 40px;                height: 40px;                border: 8px solid #666;                border-top-right-radius: 100%;                border-bottom-right-radius: 100%;                border-bottom-left-radius: 100%;                background: transparent;                position: absolute;                margin: -68px 0 0 258px;                border-left: 8px solid transparent;                border-top: 8px solid #666;                border-bottom: 8px solid #666;            }            /*座垫*/            .seat {                 width: 50px;                height: 10px;                background: #666;                border-radius: 44%;                position: absolute;                margin: -73px 0 0 15px;            }                        .seat:after {                width: 0px;                height: 0px;                border-style: solid;                border-width: 0 40px 16px 40px;                border-color: transparent transparent #666 transparent;                content: "";                position: absolute;                z-index: 3;                transform: rotate(-12deg);                position: absolute;                border-radius: 100%;                margin: 0 0 0 -26px;            }            .seat:before {                width: 0px;                height: 0px;                border-style: solid;                border-width: 0 40px 16px 40px;                border-color: transparent transparent #666 transparent;                content: "";                position: absolute;                z-index: 3;                transform: rotate(179deg);                position: absolute;                border-radius: 100%;                margin: 0 0 0 -26px;            }            .seat span {                width: 32px;                height: 19px;                background: #666;                border-radius: 100%;                position: absolute;                margin: 1px 0 0 -22px;                transform: rotate(-11deg);            }            /*去掉中心轴的*/            .chain-rotation {                position: absolute;                z-index: 16;            }            /*中心轴*/            .chain-disc-inner {                background: #666;                width: 18px;                height: 18px;                border-radius: 50%;                position: absolute;                margin: 2px;                z-index: 4;            }            .chain-disc-outer {                background: #FFF;                width: 22px;                height: 22px;                border: 5px solid #666;                border-radius: 50%;                position: absolute;                margin: 87px 0 0 250px;                z-index: 3;                content: "";            }            /*牙盘*/            .chain-rods {                height: 70px;                width: 6px;                background: #666;                position: absolute;                margin: 67px 0 0 263px;                z-index: 15;                animation: wheel-rotate 2s linear infinite;            }            .chain-rods:before {                content: "";                height: 70px;                width: 6px;                background: #666;                position: absolute;                transform: rotate(120deg);            }            .chain-rods:after {                content: "";                height: 70px;                width: 6px;                background: #666;                position: absolute;                transform: rotate(240deg);                -webkit-transform: rotate(240deg);                -moz-transform: rotate(240deg);            }            .outer-axle {                height: 70px;                width: 70px;                border-radius: 50%;                background: transparent;                border: 5px solid #666;                position: absolute;                margin: 62px 0 0 226px;                z-index: 3;            }                        .outer-axle:after {                content: "";                height: 74px;                width: 74px;                border-radius: 50%;                background: transparent;                border: 5px dotted #666;                margin: -7px;                position: absolute;                z-index: 3;                animation: wheel-rotate 2s linear infinite;            }            /*车链子*/            .chain-up {                background-color: transparent;                background-size: 8px 2px;                background-position: 0 0, 30px 30px;                width: 155px;                height: 4px;                position: absolute;                z-index: 9;                background: #EEE;                transform: rotate(-11deg);                margin: 76px 0 0 98px;            }            .chain-up:before {                content: "";                background-color: transparent;                background-image: linear-gradient(90deg, #666 25%, transparent 25%, transparent 75%, #666 75%, #666);                background-size: 8px 2px;                background-position: 0 0, 30px 30px;                width: 155px;                height: 4px;                animation: chainUp 2s linear infinite;                position: absolute;                z-index: 10;            }            .chain-bottom {                background-color: transparent;                background-size: 8px 2px;                background-position: 0 0, 30px 30px;                width: 155px;                height: 4px;                position: absolute;                z-index: 9;                background: #EEE;                -webkit-transform: rotate(9deg);                -moz-transform: rotate(9deg);                transform: rotate(9deg);                margin: 127px 0 0 98px;            }                        .chain-bottom:before {                content: "";                background-color: transparent;                background-image: linear-gradient(90deg, #666 25%, transparent 25%, transparent 75%, #666 75%, #666);                background-size: 8px 2px;                background-position: 0 0, 30px 30px;                width: 155px;                height: 4px;                animation: chainDown 2s linear infinite;                position: absolute;                z-index: 10;            }            /*脚踏*/            .pedal-rod {                height: 120px;                width: 6px;                background: #666;                position: absolute;                margin: -25px 0 0 0px;            }                        .pedal-rod:before {                width: 40px;                height: 10px;                background: #666;                position: absolute;                margin: 10px;                content: "";                margin: -7px -17px;                animation: pedal1 2s linear infinite;            }                        .pedal-rod:after {                width: 40px;                height: 10px;                background: #666;                position: absolute;                margin: 10px;                content: "";                margin: 119px -17px;                animation: pedal2 2s linear infinite;            }            /*水壶架*/            .bottle-holder {                width: 20px;                height: 36px;                background: #daeded;                border: 3px solid #5E999B;                position: absolute;                margin: 54px 0 0 -25px;            }                        .bottle-holder:after {                width: 20px;                height: 3px;                content: "";                background: #5E999B;                position: absolute;                margin: 24px 0 0 0px;            }            /*水壶*/            .bottle-holder:before {                background-color: #daeded;                width: 18px;                height: 10px;                border-radius: 30% / 100%;                border-bottom-left-radius: 0;                border-bottom-right-radius: 0;                content: "";                position: absolute;                margin-top: -13px;                border: 1px solid #98baba;                border-bottom: 0;            }            .bottle-holder span {                position: absolute;                width: 9px;                height: 4px;                background: #666;                margin: -17px 0 0 5px;            }            /*车链子动画*/            @keyframes chainUp {                0% {                    background-position: 0 25%;                }                100% {                    background-position: 100% 0;                }            }            @keyframes chainDown {                0% {                    background-position: 100% 0;                }                100% {                    background-position: 0 25%;                }            }            /*脚踏动画*/            @keyframes pedal1 {                0% {                    transform: rotate(00deg);                }                25% {                    transform: rotate(-140deg);                }                50% {                    transform: rotate(-180deg);                }                75% {                    transform: rotate(-240deg);                }                100% {                    transform: rotate(-360deg);                }            }            @keyframes pedal2 {                0% {                    transform: rotate(00deg);                }                25% {                    transform: rotate(-60deg);                }                50% {                    transform: rotate(-180deg);                }                75% {                    transform: rotate(-340deg);                }                100% {                    transform: rotate(-360deg);                }            }                        

以上就是纯CSS3打造自行车的详细内容,更多请关注创想鸟其它相关文章!

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

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月24日 04:37:50
下一篇 2025年12月24日 04:38:04

相关推荐

  • CSS3实现各种表情(代码示例)

    css3实现各种表情  效果图: 代码如下,复制即可使用: body { text-align: center; margin: 80px auto 0; font-family: “Lucida Sans Unicode”, “Lucida Grande”, sans-serif;}.emoji …

    2025年12月24日
    000
  • css3是什么

    css3是css(层叠样式表)技术的升级版本,于1999年开始制订,2001年5月23日w3c完成了css3的工作草案,主要包括盒子模型、列表模块、超链接方式、语言模块、背景和边框、文字特效、多栏布局等模块。 CSS演进的一个主要变化就是W3C决定将CSS3分成一系列模块。(推荐学习:CSS视频教程…

    2025年12月24日
    000
  • CSS3 :first-child选择器怎么用

    css :first-child选择器用于匹配其父元素中的第一个子元素;即只有当元素是其父元素的第一个子元素时才会匹配元素。 CSS3 :first-child选择器怎么用? :first-child 选择器匹配其父元素中的第一个子元素。 语法: 元素:first-child{ css样式} 例:匹…

    2025年12月24日
    000
  • CSS 如何进行单一div的正多边形变换

    本文是纯粹利用css,让“单一个”div,从正三角形变换为正八边形(单一div最多只能做到正八边形),最后再搭配动画的效果,变成正多边形的变换动画,也由于正多边形需要用到不少的三角函数计算,为了方便起见,这里将正多边形的边统一都设为100px。 正三角形 正三角形不需要用到伪元素,只需要设定p本身的…

    2025年12月24日 好文分享
    000
  • CSS3实现的11种基本图形代码

    本篇文章给大家带来的内容是关于css3实现的11种基本图形代码,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 CSS3圆角 #css3-circle{ width: 150px; height: 150px; border-radius: 50%; } CSS3 椭圆形css3 r…

    好文分享 2025年12月24日
    000
  • css3新特性有哪些

    CSS3的新特征有:1、圆角效果;2、图形化边界;3、块阴影与文字阴影;4、使用RGBA实现透明效果;5、渐变效果;6、使用“@Font-Face”实现定制字体;7、多背景图;8、文字或图像的变形处理;9、多栏布局;10、媒体查询等。 本文操作环境:Windows7系统,css3版,Dell G3电…

    2025年12月24日
    000
  • flex作用于box容器上的属性介绍

    本篇文章给大家带来的内容是关于flex作用于box容器上的属性介绍,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 1. flex-direction 用于指定flex主轴的方向,继而决定flex子项在flex容器中的位置 row,默认值,表示水平方向从左到右排列,此时水平方向为主轴…

    好文分享 2025年12月24日
    000
  • 有趣的CSS魔法和布局(代码)

    本篇文章给大家带来的内容是关于有趣的CSS魔法和布局(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 前言:布局和样式,是每个前端的必修课。在日常的工作中,也会碰到一些特定场景的布局需求,配合上样式,就能实现一些神奇的效果。我搜罗了一些日常开发中遇到的布局,以及浏览各大网站时…

    2025年12月24日
    000
  • 选择器(picker)插件的实现方法介绍(代码)

    本篇文章给大家带来的内容是关于选择器(picker)插件的实现方法介绍(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 一个正常的选择器插件是非常细致的,一步一步来描述就是。手指滑动内容跟随手指滚动,当内容到底或触顶的时候就不能在滚动并且内容要一直保持在正确的位置上。 第一步…

    2025年12月24日
    000
  • CSS实现基于用户滚动应用(代码)

    本篇文章给大家带来的内容是关于css实现基于用户滚动应用(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 通过将当前滚动偏移映射到html元素上的属性,我们可以根据当前滚动位置设置页面上的元素样式。我们可以使用它来构建一个浮动导航组件。 这是我们将使用的HTML, 当我们向下…

    好文分享 2025年12月24日
    000
  • react中使用css的七种方法介绍(附代码)

    本篇文章给大家带来的内容是关于react中使用css的七种方法介绍(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 第一种: 在组件中直接使用style 不需要组件从外部引入css文件,直接在组件中书写。 import React, { Component } from “…

    2025年12月24日
    000
  • CSS3中box-sizing属性的解析(附代码)

    本篇文章给大家带来的内容是关于css3中box-sizing属性的解析(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 盒模型的组成大家肯定都懂,由里向外content,padding,border,margin. 盒模型是有两种标准的,一个是标准模型,一个是IE模型。 立…

    2025年12月24日 好文分享
    000
  • CSS3中的background-clip属性怎么用

    CSS3中的background-clip属性的用法:【background-clip:border-box|padding-box|content-box】。background-clip属性用于规定背景的绘制区域。 css background-clip属性 作用:规定背景的绘制区域。 (推荐教…

    2025年12月24日
    000
  • css3 icon属性怎么用?

    css3的icon属性用于为创作者提供了将元素设置为图标等价物的能力。 CSS3 icon属性 作用:icon 属性为创作者提供了将元素设置为图标等价物的能力。 语法: icon: auto|URL; auto:使用由浏览器提供的默认通用图标。     立即学习“前端免费学习笔记(深入)”; URL…

    2025年12月24日
    000
  • CSS3 appearance属性怎么用?

    css3 appearance属性用于修改元素的默认的样式,改变元素的外观。 CSS3  appearance属性 作用:appearance 属性允许您使元素看上去像标准的用户界面元素。 语法: appearance: normal|icon|window|button|menu|field; 属…

    2025年12月24日
    000
  • css3 nav-right属性怎么用?

    css3 nav-right属性是一个CSS3属性,用于指定当使用箭头向右的导航键时,向何处进行导航,其语法是“nav-right: auto|id|target-name;”,参数“auto”表示浏览器决定导航到哪个元素。 nav-right属性是一个CSS3属性,用于指定当使用箭头向右的导航键时…

    2025年12月24日
    000
  • text-emphasis属性有什么用

    text-emphasis属性用于把指定的强调标记应用到元素文本中除去分隔符字符(如空格和控制字符)的每个字符。 CSS3  text-emphasis属性 text-emphasis 属性是简写属性,用于在一个声明中设置 text-emphasis-style 和 text-emphasis-co…

    2025年12月24日
    000
  • column-count属性怎么用

    column-count属性时用来指定某个元素应分为多少列数显示的。 CSS3  column-count属性 作用:column-count属性指定某个元素应分为的列数。 语法: column-count: number|auto; 参数: auto:默认值,列数将取决于其他属性,例如:&#822…

    2025年12月24日
    000
  • column-gap属性怎么用

    column-gap属性用于指定的列之间的差距,在指定某个元素应分为多少列之后使用。 CSS3 column-gap属性 作用:column-gap属性用于指定的列之间的差距。 使用条件:在使用column-count属性或column-width属性设置好元素的列数后,column-gap属性才会…

    2025年12月24日
    000
  • column-width属性怎么用

    column-width属性用于指定列的宽度;当没有明确指定元素的显示列数时,可通过该属性设置显示列数。 CSS3  column-width属性 作用:column-width属性用于指定列的宽度。 语法: column-width: auto|length; 参数: auto:由浏览器决定列宽;…

    2025年12月24日
    000

发表回复

登录后才能评论
关注微信