CSS3实现Material Design的示例代码分享

不断更新中

预览

CSS3实现Material Design的示例代码分享

这是一个正在完善的css文件,是对原生组件基于标签属性做了美化,对datepicker,select等无法用css实现的暂不考虑在本文内。

按钮 Button

初始按钮

                        

描边按钮

                    

禁用按钮

    

上浮按钮

        

按钮组

    

表单Form

文本输入


开关

 

单选

多选

部分样式

article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary {    display: block}audio,canvas,progress,video {    display: inline-block;    vertical-align: baseline}audio:not([controls]) {    display: none;    height: 0}[hidden],template {    display: none}li {    list-style: none}a {    background-color: transparent}a:active,a:hover {    outline: 0}abbr[title] {    border-bottom: 1px dotted}b,strong {    font-weight: 700}dfn {    font-style: italic}h1 {    font-size: 2em;    margin: .67em 0}mark {    background: #ff0;    color: #000}small {    font-size: 80%}sub,sup {    font-size: 75%;    line-height: 0;    position: relative;    vertical-align: baseline}sup {    top: -.5em}sub {    bottom: -.25em}img {    border: 0}svg:not(:root) {    overflow: hidden}figure {    margin: 1em 40px}hr {    box-sizing: content-box;    height: 0}pre {    overflow: auto}code,kbd,pre,samp {    font-family: monospace, monospace;    font-size: 1em}button,input,optgroup,select,textarea {    color: inherit;    font: inherit;    margin: 0}button {    overflow: visible}button,select {    text-transform: none}button,html input[type=button],input[type=reset],input[type=submit] {    -webkit-appearance: button;    cursor: pointer}button[disabled],html input[disabled] {    cursor: default}button::-moz-focus-inner,input::-moz-focus-inner {    border: 0;    padding: 0}input {    line-height: normal}input[type=checkbox],input[type=radio] {    box-sizing: border-box;    padding: 0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button {    height: auto}input[type=search] {    -webkit-appearance: textfield;    box-sizing: content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration {    -webkit-appearance: none}fieldset {    border: 1px solid silver;    margin: 0 2px;    padding: .35em .625em .75em}legend {    border: 0;    padding: 0}textarea {    overflow: auto}optgroup {    font-weight: 700}table {    border-collapse: collapse;    border-spacing: 0}td,th {    padding: 0}/*html*/html {    font-family: sans-serif;    -ms-text-size-adjust: 100%;    -webkit-text-size-adjust: 100%}/*body*/body{    margin: 0;    background-color: rgb(238,238,238);    font-size:16px;    padding: 20px;    -webkit-box-sizing: border-box;    box-sizing: border-box;    font-family: "Microsoft YaHei";    color:#333;    text-shadow: 0 0 0.1px rgba(0,0,0,0.2);}/*button*/    button {        opacity: 0.9;        line-height: 1rem;        padding:  0.5rem 1rem;        border: none;        outline: none;      background-color: white;      text-decoration: none;      position: relative;      border-radius:2px;      box-shadow:0 1px 3px darkgray;      transition: box-shadow 0.5s ease-out;    } button::before{      content: '';    display:block;      position: absolute;      left: 50%;      top: 50%;      border-radius: 10%/40%;      -webkit-transform: translate(-50%, -50%) ;      transform: translate(-50%, -50%) ;      height: 100%;      width: 100%;      z-index: -1;      -webkit-transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);      transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);  }  button:hover{    box-shadow:0 6px 16px darkgray;      transition: all 0.8s ease-out;  }button:active{ opacity: 1;      -webkit-transition: all 0.5s ease-out;      transition: all 0.3s ease-out;}  button:active::before{      width: 0;      height: 100%;      border-radius: 0;      background-color: rgba(0,0,0,.4);      -webkit-transition: all 0.01s ease-out;      transition: all 0.01s ease-out;  }button.link{    background:none;    color:#0275d8;    box-shadow: none;}button[disabled]{    background-color:lightgray;    color:darkgray;    cursor:not-allowed;    box-shadow: none;}.circle{    border-radius: 100%;}button.circle{    padding: 0;    width: 3rem;height: 3rem;font-size: 1.5rem;      box-shadow:0 6px 12px darkgray;}button.circle:hover{      box-shadow:0 12px 24px darkgray;} button.circle::before{      content: '';    display:block;      position: absolute;      left: 50%;      top: 50%;      border-radius: 100%;      -webkit-transform: translate(-50%, -50%) ;      transform: translate(-50%, -50%) ;      height: 100%;      width: 100%;      z-index: -1;      -webkit-transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);      transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);  }  button.circle:active::before{      width: 0;      height: 0;      border-radius: 100%;      background-color: rgba(0,0,0,.4);      -webkit-transition: all 0.01s ease-out;      transition: all 0.01s ease-out;  }/*form*/input[type=text],input[type=password],input[type=number]{    padding: 0;    border:none;    text-indent: 0.5em;    background: none;    outline: none;    border-bottom:2px solid #555;    line-height: 32px;        height: 32px;    box-sizing: border-box;}input[type=text]:focus,input[type=password]:focus,input[type=number]:focus{    border-bottom-color: rgb(0,150,136);    color: rgb(0,150,136);}input[type=checkbox],input[type=radio]{    display: none;}input[type=checkbox]+label,input[type=radio]+label{        line-height: 1em;    text-indent: 1.2em;    width: 1em;    height: 1em;    margin: 0.2em 0.1em;    border: 2px solid #555;    border-radius: 2px;    padding: 0px;    display: inline-block;    position: relative;    cursor: pointer;}input[type=radio]+label{    border-radius: 1em;}input[type=checkbox]:checked+label,input[type=radio]:checked+label{    border-color:  rgb(0,150,136);}input[type=checkbox]:checked + label:after{    content: '';    display: block;    width: 0.7em;    height: 0.3em;    margin: 0.2em 0.1em;    top: 0;    left: 0;    transform:rotate(-45deg);    -moz-transform:rotate(-45deg);    -webkit-transform:rotate(-45deg);    position: absolute;    border-left: 0.15em solid rgb(238,238,238);    border-bottom: 0.15em solid rgb(238,238,238);}input[type=radio]:checked + label{    background: rgb(0,150,136);    box-shadow: 0 0 0 3px rgb(238,238,238) inset;}input[type=checkbox] + label:before,input[type=radio] + label:before{      content: '';    display:block;      position: absolute;      left: 50%;      top: 50%;      border-radius: 100%;      -webkit-transform: translate(-50%, -50%) ;      transform: translate(-50%, -50%) ;      height: 4em;      width: 4em;      z-index: -1;      -webkit-transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);      transition: all 0.5s cubic-bezier(0.23, 0.95, 0.56, 1);}  input[type=checkbox]+ label:active::before,input[type=radio]+ label:active::before{      width: 0;      height: 0;      border-radius: 100%;      background-color: rgb(0,150,136);      -webkit-transition: all 0.01s ease-out;      transition: all 0.01s ease-out;  }  input[type=checkbox]:checked+ label:active::before,input[type=radio]:checked+ label:active::before{      background-color: gray;  }input[type=checkbox]:checked + label,input[type=radio]:checked + label {    background-color: rgb(0,150,136);    color: rgb(0,150,136);}input[type=checkbox] + label:active, input[type=checkbox]:checked + label:active,input[type=radio] + label:active, input[type=radio]:checked + label:active {    background-color:  rgb(0,150,136);} input[type=checkbox]:disabled + label, input[type=radio]:disabled + label{     border-color:lightgray;color:lightgray;background-color: lightgray;pointer-events: none; } input[type=checkbox].switch+label{    left :0;    border-radius: 1em;    border-color:gray; } input[type=checkbox]:checked.switch+label{    left:1.5em;    border-color:rgb(0,150,136);  } input[type=checkbox].switch+label:after{     content: "";     position: absolute;     display: block;     margin-top: 50%;    border-bottom: 2px solid lightgray;    width: 1.4em;    height: 0;    transform:rotate(0deg);    -moz-transform:rotate(0deg);    -webkit-transform:rotate(0deg);    margin-left :1.1em; } input[type=checkbox]:checked.switch+label:after{    border-bottom: 2px solid rgb(0,150,136);     margin-left :-1.1em; }nav.btn-group{    border-radius: 2px;overflow: hidden;float: left;} nav.btn-group button{    float: left;border-radius: 0;    box-shadow: none; }   nav.btn-group button:hover{    box-shadow: none;   }  nav.btn-group button:hover::after{      content: "";    display: block;    position: absolute;    width: 100%;    height: 100%;    top: 0;    left: 0;    background: rgba(0, 0, 0, 0.11);}nav.menu{    height: 3rem;padding: 0 1em;background: white;}nav.menu>ul{    padding: 0 1em;margin:0;line-height: 3rem;float: left;}mav.menu>ul>li{    display: block;}.b-red{border: 1px solid #d9534f;color:#d9534f;}.b-orange{border: 1px solid #ec971f;color:#ec971f;}.b-blue{border: 1px solid #5CA3DE;color:#5CA3DE;}.b-green{border: 1px solid #71CA71;color:#71CA71;}.b-navy { border: 1px solid  #001f3f;color: #001f3f;}.b-aqua { border: 1px solid  #7fdbff;color: #7fdbff;}.b-teal { border: 1px solid  rgb(0,150,136);color: rgb(0,150,136);}.b-olive { border: 1px solid  #3d9970;color: #3d9970;}.b-lime { border: 1px solid  #01ff70;color: #01ff70; }.b-yellow { border: 1px solid  #ffdc00;color: #ffdc00; }.b-orange { border: 1px solid  #ff851b;color: #ff851b; }.b-red { border: 1px solid  #ff4136;color: #ff4136; }.b-fuchsia { border: 1px solid  #f012be;color: #f012be; }.b-purple { border: 1px solid  #b10dc9;color: #b10dc9; }.b-maroon { border: 1px solid  #85144b;color: #85144b; }.b-white { border: 1px solid  #ffffff;color: #ffffff; }.b-gray { border: 1px solid  #aaaaaa;color: #aaaaaa; }.b-silver { border: 1px solid  #dddddd;color: #dddddd; }.b-black { border: 1px solid  #111111;color: #111111; }.bk-n{background: none;}.bs-n{box-shadow: none;}.red{background-color:#d9534f;color:white;}.orange{background-color:#ec971f;color:white;}.blue{background-color:#5CA3DE;color:white;}.green{background-color:#71CA71;color:white;}.navy { background-color: #001f3f; color:white;}.aqua { background-color: #7fdbff;color:white; }.teal { background-color: rgb(0,150,136); color:white;}.olive { background-color: #3d9970; color:white;}.lime { background-color: #01ff70; }.yellow { background-color: #ffdc00; }.orange { background-color: #ff851b; }.red { background-color: #ff4136; }.fuchsia { background-color: #f012be; }.purple { background-color: #b10dc9; }.maroon { background-color: #85144b; }.white { background-color: #ffffff; }.gray { background-color: #aaaaaa; }.silver { background-color: #dddddd; }.black { background-color: #111111; }.c-red{color:#d9534f;}.c-orange{color:#ec971f;}.c-blue{color:#5CA3DE;}.c-green{color:#71CA71;}.c-navy { color: #001f3f; }.c-aqua { color: #7fdbff; }.c-teal { color: rgb(0,150,136); }.c-olive { color: #3d9970; }.c-lime { color: #01ff70; }.c-yellow { color: #ffdc00; }.c-orange { color: #ff851b; }.c-red { color: #ff4136; }.c-fuchsia { color: #f012be; }.c-purple { color: #b10dc9; }.c-maroon { color: #85144b; }.c-white { color: #ffffff; }.c-gray { color: #aaaaaa; }.c-silver { color: #dddddd; }.c-black { color: #111111; }.fl,.fl *{display:block;float: left;clear: none;}.fl-l{float: left}.fl-r{float: right}.fl-n{float:none}.w-1 {width: 4.166666667%}.w-2 {width: 8.333333333%}.w-3 {width: 12.5%}.w-4 {width: 16.66666667%}.w-5 {width: 20.83333333%}.w-6 {width: 25%}.w-7 {width: 29.16666667%}.w-8 {width: 33.33333333%}.w-9 {width: 37.5%}.w-10 {width: 41.66666667%}.w-11 {width: 45.83333333%}.w-12 {width: 50%}.w-13 {width: 54.16666667%}.w-14 {width: 58.33333333%}.w-15 {width: 62.5%}.w-16 {width: 66.66666667%}.w-17 {width: 70.83333333%}.w-18 {width: 75%}.w-19 {width: 79.16666667%}.w-20 {width: 83.33333333%}.w-21 {width: 87.5%}.w-22 {width: 91.66666667%}.w-23 {width: 95.83333333%}.w-24 {width: 100%}.h-1 {height: 16px;line-height: 16px;}.h-2 {height: 28px;line-height: 28px;}.h-3 {height: 32px;line-height: 32px;}.h-4 {height: 48px}.h-5 {height: 64px}.h-6 {height: 80px}.h-7 {height: 96px}.t-l{text-align: left}.t-c{text-align: center}.t-r{text-align: right}.f,.f *{display: flex}.f-1    {flex:1}.f-2    {flex:2}.f-3    {flex:3}.f-4    {flex:4}.f-5    {flex:5}.f-6    {flex:6}.f-7    {flex:7}.f-8    {flex:8}.f-9    {flex:9}.f-10{flex:10}.f-11{flex:11}.f-12{flex:12}.f-13{flex:13}.f-14{flex:14}.f-15{flex:15}.f-16{flex:16}.f-17{flex:17}.f-18{flex:18}.f-19{flex:19}.f-20{flex:20}.f-21{flex:21}.f-22{flex:22}.f-23{flex:23}.f-24{flex:24}

                                                  

以上就是CSS3实现Material Design的示例代码分享的详细内容,更多请关注创想鸟其它相关文章!

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

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月23日 22:17:38
下一篇 2025年12月23日 22:17:41

相关推荐

  • CSS3+jQuery实现环形进度条的详解

    整体思路是:通过裁切(clip)产生两个半圆展示出静态的进度条,而后通过旋转(rotate)角度的变化产生动态效果。 先来回顾两个基础知识点 (1)css的一个不常见的属性: clip: rect(top, right, bottom, left); 这个属性规定了一个裁切的矩形,其中top和bot…

    2025年12月23日 好文分享
    000
  • 分享几个常用的最新的css3属性

    这里给大家推荐4个css3的新属性,非常的实用,附上示例,有需要的朋友可以好好研究下。做项目经常会用到 css3刚推出不久,虽然大多数的css3属性在很多流行的浏览器中不支持,但我个人觉得还是要尽量开始慢慢的去了解并使用css3(还有html5),因为我觉得这是一种趋势,它是一种已经被制定的标准。我…

    2025年12月23日 好文分享
    000
  • 整合20个CSS/CSS3常用属性

    这里我总结了一下平时自己在项目中经常用到的20个css常用的样式,都是些个人的经验,这里分享给大家,希望对大家有所帮助 1.强制文本单行显示:white-space:nowrap; 2.设置溢出文本显示为省略标记:text-overflow:ellipsis;(注:text-overflow:cli…

    好文分享 2025年12月23日
    000
  • 阐述什么是CSS3?

    网页制作Webjx文章简介:CSS3不是新事物,更不是只是围绕border-radius属性实现的圆角。它正耐心的坐在那里,已经准备好了首次登场,呷着咖啡,等着浏览器来铺上红地毯。            CSS3不是新事物,更不是只是围绕border-radius属性实现              …

    好文分享 2025年12月23日
    000
  • 分享22款H5和CSS3的帮助工具

    收集的22款给力的html5和css3帮助工具,需要的朋友可以参考下 1. CSS3 Selectors Test在打开这个地址时,它会自动测试你当前使用浏览器所支持的css属性,然后用一个列表的形式给展示出来;你可以点击列表中列出的每个项目来查看结果,包括一个小例子和相应的解释内容。 2. CSS…

    2025年12月23日 好文分享
    000
  • 介绍CSS3中的几个新技术

    网页制作Webjx文章简介:网页教学网将在这篇文章向大家展示CSS中的5个有趣的新技术:圆角、个别圆角、不透明度、阴影和调整元素大小.            CSS是众所周知且应用广泛的网站样式语言,在它的版本三(CSS3)计划中,新增了一些能够节省时                        …

    2025年12月23日
    000
  • 用css3制作图片翻转效果

    本文给大家分享的是一则使用原生css3实现的图片翻牌效果,十分的炫酷,代码却很简单,这里推荐给有相同需求的小伙伴们。 大家先看下效果演示: 是不是非常不错,下面把实现代码分享给大家。 代码如下: 立即学习“前端免费学习笔记(深入)”; css3 翻牌*{ margin:0; padding:0;}u…

    2025年12月23日
    000
  • 关于CSS3中的content属性实例详解

    这篇文章主要介绍了css3中的content属性使用示例,是为css3入门学习中的基础知识,需要的朋友可以参考下 CSS中主要的伪元素有四个:before/after/first-letter/first-line,在before/after伪元素选择器中,有一个content属性,能够实现页面中的…

    好文分享 2025年12月23日
    000
  • 详解CSS3中10个顶级命令

    css3中必须要知道的10个顶级命令,都是一些不错的效果实现代码,喜欢的朋友可以收藏下1.边框圆角(border radiuas) 这个是我们在平常很常用的吧,以前我在用p圆角的时候,特别特别的痛苦,不管是用css来画圆角,还是用图片来画圆角都不那么容易,但是现在好了,在css3中,直接只需要如下面…

    2025年12月23日 好文分享
    000
  • 简述网页设计师怎么使用好CSS3技术

    在本文中,我们将研究css3的优势,并看一下一些网页设计师是如何使用它们的。最后,我们将了解到从css3中我们能得到什么以及我们如何在我们的项目中使用它的新特性。 前些日子在SmashingMagazine看到一篇关于CSS3新技术不错的文章,它详细介绍了CSS3的新特性和它的使用方法,它包括:浏览…

    2025年12月23日 好文分享
    000
  • css3制作鼠标经过按钮特效

    这篇文章主要为大家介绍了利用css3制作的一款鼠标经过按钮特效,当鼠标放在按钮上,按钮就会发生变化,产生一个动态效果,非常漂亮。需要的朋友可以参考下   今天再给大家带来一款纯css3实现的鼠标经过按钮特效。这款按钮非常简单,但效果很好,非常漂亮。一起看下效果图:   实现的代码。   html代码…

    2025年12月23日
    000
  • 用css3显示隐藏div的实例教程

    显示隐藏一个p特效的方法有很多,下为大家介绍下使用纯css3是如何实现的,感兴趣的朋友可以参考下 代码如下: #showp { background-color:red; width:300px; height:300px; display:none; } .from-below, .from-be…

    好文分享 2025年12月23日
    000
  • CSS3圆角、盒阴影与边框图片的具体详解

    今天开始整理CSS3的知识  其实应该是昨晚写的,不过好像是急性肠胃炎了,痛的一晚上没睡着,蓝瘦香菇 还好今天打点滴睡一觉就好了,看来这吃东西还是注意点好,被我的胃肠报复了 css没什么难的,不过看的同时自己要在浏览器上试一试,试一遍就记住了 光看不做白看 CSS3各个浏览器是存在兼容问题的 不同浏…

    2025年12月23日 好文分享
    000
  • CSS3中的颜色值RGBA以及渐变色的具体详解(图)

    css3之前渐变色图片只能用背景图片 css3的渐变色语法可以让我们省去下载图片的开销 并且在改变浏览器分辨率时有更好的效果 颜色值RGBA 我们熟悉的rgb颜色标准,是由r(red)、g(green)、b(blue)三种颜色叠加变化形成各种颜色 取值0~255,或0~100% rgba就是在rgb…

    2025年12月23日 好文分享
    000
  • CSS3字体与文本效果的示例代码分享

    CSS3允许我们使用自定义字体  也多了一些不错的文本效果 自定义字体 使用自定义字体需要使用@font-face规则 当然首先你要有自定义文字文件 Payen S.Tsung @font-face { font-family: myDIYfont; /*自定义字体名*/ src: url(‘Gin…

    2025年12月23日 好文分享
    000
  • 关于CSS3多重背景及背景图片裁剪和定位以及尺寸的具体详解

    CSS3之前我们可以对背景添加一张图片  css3允许我们在一个元素上添加多个图片 多重背景图片 .demo { width: 600px; height: 200px; border: 1px solid black; background: url(‘1.png’) no-repeat;} 多重…

    2025年12月23日 好文分享
    000
  • CSS3完成图片lowpoly动画效果的过程详解

    本篇文章主要介绍了css3实现任意图片lowpoly动画效果实例,这是一个利用css3的动画属性实现的结合lowpoly(低多边形风格)的效果,主要利用了css3 transform属性的rotate旋转,translate移动,scale缩放 这是一个利用CSS3的动画属性实现的结合lowpoly…

    2025年12月23日 好文分享
    000
  • 通过CSS3伪元素完成逐渐发光的边框的代码详解

    这篇文章主要给大家介绍了利用css3伪元素实现逐渐发光的方格边框的相关资料,文中给出了详细的示例代码供大家参考学习,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。 本文介绍的是一个使用伪元素来实现边框逐渐发光的代码,主要用到scale和opacity这两个属性。下面来看看详细的介绍: …

    2025年12月23日
    000
  • 关于H5和CSS3表单验证的使用教程

    这篇文章主要介绍了使用html5和css3表单验证功能,需要的朋友可以参考下 客户端验证是网页客户端程序最常用的功能之一,我们之前使用了各种各样的js库来进行表单的验证。HTML5其实早已为我们提供了表单验证的功能。至于为啥没有流行起来估计是兼容性的问题还有就是样式太丑陋了吧。 下面我们将来一步一步…

    2025年12月23日 好文分享
    000
  • CSS3中的盒模型与盒模型属性box-sizing的详细介绍

    这两天写的都是小知识点  因为确实有点忙 虽然很简单,但是本着全面总结的原则,还是要说一下 今天我来说一下这个css中的盒模型 以及css3中可以改变盒模型的属性 盒模型 盒模型是计算元素尺寸的模型规则 在我们CSS中盒模型分为两种 W3C标准盒模型 正常情况下我们用的都是这个标准的盒模型 标准盒模…

    2025年12月23日
    000

发表回复

登录后才能评论
关注微信