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)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
CSS实现Footer置底的五种方式的分享
上一篇 2025年12月23日 22:17:38
CSS3+jQuery实现环形进度条的详解
下一篇 2025年12月23日 22:17:41

相关推荐

  • 利用css3仿造window7的开始菜单

    相当逼真,css3果然强悍。要留意的点依旧是哪几项,难点在于细节的微调,尤其是渐变背景的制作,css3中非常灵活,下次有机会,发篇css3渐变背景的详细教程。   相当逼真,css3果然强悍。友情提示:请勿在IE下浏览。来看下原作者的设计草图: 简明创建过程  第一步 :创建如下菜单结构 @@##@…

    2026年5月10日
    000
  • 怎么安装html5_HTML5开发环境安装与配置详细步骤

    答案是配置HTML5开发环境需三步:1. 安装VS Code等编辑器并配置插件;2. 使用Chrome或Firefox测试页面;3. 可选搭建本地服务器,如Live Server或http-server;最后创建index.html文件验证环境。 安装HTML5开发环境其实并不复杂,因为HTML5本…

    2026年5月10日
    000
  • 使用CSS Grid实现不规则列布局:告别传统表格的限制

    本教程详细阐述如何利用css grid实现复杂的、不规则的列布局,尤其适用于那些传统html表格难以实现的块状结构。文章将通过具体的css属性和html结构示例,指导读者如何定义网格、控制子项的跨度与位置,以及优化自动布局流程,从而高效构建灵活且响应式的页面布局。 1. 传统表格的局限与CSS Gr…

    2026年5月10日
    000
  • border-radius属性如何使用

    border-radius属性用于创建圆角,其使用语法是“border-radius: 1-4 length|%;”,border-radius是一个最多可指定四个“border -*- radius”属性的复合属性。 本文操作环境:Windows7系统、Dell G3电脑、HTML5&&a…

    2026年5月10日
    000
  • 详解img[src=””] img无路径情况下,灰色边框去除解决方法

    img[src=””]  img标签无路径情况下,灰色边框去除解决方案 1.Js解决办法 @@##@@ function whenError(a){ a.onerror=null; a.src=’path_default.jpg’; console.log(‘图片出错的时候调…

    用户投稿 2026年5月10日
    000
  • HTML5怎么制作天气应用_HTML5天气组件开发实战

    使用HTML5、CSS3和JavaScript结合OpenWeatherMap API可快速开发响应式天气应用。2. 页面结构包含输入框、按钮和结果显示区域。3. 通过fetch调用API获取实时天气数据,支持中文和摄氏度单位。4. 数据渲染包括城市名、温度、图标、湿度和风速,并用CSS美化界面。5…

    2026年5月10日
    000
  • 关于CSS3字体属性整理分析

     字体属性: Font-family: {font-family: name}           {font-family: cursive| fantasy | monospace | serif | sans-serif} Font-size: {font-size: 数值 | inherit…

    用户投稿 2026年5月10日
    000
  • 使用Flexbox实现内容居中布局:从页脚固定到内容对齐

    本文深入探讨了如何利用CSS Flexbox实现网页内容的精确居中对齐,尤其是在包含固定页脚的复杂布局中。我们将通过分析一个常见的布局问题,逐步讲解如何配置Flex容器及其子项的属性,如`display: flex`、`flex-direction`、`justify-content`和`text-…

    2026年5月10日
    000
  • 学习html5编程路径_从基础到项目实战路线【方法】

    需遵循由浅入深的学习路径:一、分阶段夯实HTML/CSS/JS基础与HTML5新API;二、通过待办列表、Canvas画板等微型项目整合技能;三、参与开源或复刻经典界面提升工程素养;四、用Vite等工具实践构建流程;五、打造可展示的全栈作品集。 如果您希望系统性地掌握HTML5编程技能,并最终能够独…

    2026年5月10日
    600
  • css权重是什么?css权重的介绍

    本篇文章给大家带来的内容是关于css权重是什么?css权重的介绍,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 1、什么是css权重?css6大基础选择器 css权重指的是css6大基础选择符的优先级,优先级高的css样式会覆盖优先级底的css样式,优先级越高说明权重越高,反之亦然…

    2026年5月10日
    100
  • 如何使用CSS的Grid布局实现小松鼠邮票的效果(附源码)

    本篇文章给大家带来的内容是关于如何使用css的grid布局实现小松鼠邮票的效果(附源码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 效果预览 源代码下载 每日前端实战系列的全部源代码请从 github 下载: https://github.com/comehope/front-…

    2026年5月10日
    000
  • 使用CSS3实现鼠标悬停图片上浮显示描述的示例代码分享

    使用CSS3实现鼠标悬停图片上浮显示描述的示例代码分享使用CSS3实现鼠标悬停图片上浮显示描述的示例代码分享使用CSS3实现鼠标悬停图片上浮显示描述的示例代码分享使用CSS3实现鼠标悬停图片上浮显示描述的示例代码分享

    效果图: 代码如下: CSS3鼠标悬停图片上浮显示描述特效 – 何问起.hovertree-container{border:0px solid red;}.container{background-color:white}.hovertreeinfo{text-align:center;}a{co…

    2026年5月10日 用户投稿
    000
  • css3中新增加的颜色模式有哪些

    css新增了3种颜色模式:1、RGBA模式,是在RGB模式上新增了Alpha透明度,例“rgba(255,0,0,0.5)”;2、HSL模式,例“hsl(360,50%,50%)”;3、HSLA模式,是在HSL模式上新增了Alpha透明度。 本教程操作环境:windows7系统、CSS3版、Dell…

    2026年5月10日
    000
  • css3 animation属性怎么用

    css3 animation属性是一个简写属性,通过设置六个动画属性来实现动画效果。这六个属性分别为动画名称、动画时间、速度曲线、动画延迟、播放次数及动画是否反向播放。 css3 animation属性 作用:animation 属性是一个简写属性,用于设置六个动画属性。 语法: animation…

    2026年5月10日
    000
  • 如何使用CSS3实现千变万化的文字阴影text-shadow的效果

    如何使用CSS3实现千变万化的文字阴影text-shadow的效果如何使用CSS3实现千变万化的文字阴影text-shadow的效果如何使用CSS3实现千变万化的文字阴影text-shadow的效果如何使用CSS3实现千变万化的文字阴影text-shadow的效果

    这篇文章主要介绍了css3实现千变万化的文字阴影text-shadow效果设计的相关资料,感兴趣的小伙伴们可以参考一下 本文实例为大家分享了CSS3千变万化的文本阴影text-shadow效果实例,供大家参考,具体内容如下 语法: none||none|[,]*或none||[,]* 取值简单说明:…

    2026年5月10日 用户投稿
    000
  • CSS3实现预载动画效果的几种方法

    CSS3实现预载动画效果的几种方法CSS3实现预载动画效果的几种方法CSS3实现预载动画效果的几种方法CSS3实现预载动画效果的几种方法

    本篇文章主要介绍了css3动画:5种预载动画效果实例,内容挺不错的,现在分享给大家,也给大家做个参考。 实现如图所示的动画效果: 预载动画一:双旋圈 在两个不同方向旋转的圆圈。我们对内圈的转速定义了一个CSS代码,即内圈比外圈的速率快2倍。 实现如图所示: 立即学习“前端免费学习笔记(深入)”; h…

    2026年5月10日 用户投稿
    000
  • 使用HTML5和CSS3实现生日蛋糕的制作

    这篇文章主要介绍了关于使用HTML5和CSS3实现生日蛋糕的制作,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 “祝你生日快乐,祝你生日快乐……”,过生日有生日歌,生日蛋糕也是必不可少的,这篇文章主要为大家详细介绍了程序员利用纯HTML5+CSS3制作的生日蛋糕,具有一定的参考价值,…

    2026年5月10日
    000
  • CSS3中有哪些伪类选择器, 伪类选择器nth-child() 怎么使用

    css3中新的属性给我们带来了不少的便利,比如伪类选择器 nth-child(),但是它在ie6-8和ff3.0-浏览器不支持,css3中nth-of-type(n)(比如nth-of-type(1))这个特殊的类选择符可以设置更加个性的标题和段落等,不过,目前nth-of-type(n)只支持火狐…

    用户投稿 2026年5月10日
    000
  • html5如何转圈动画_制作HTML5元素转圈动画效果【效果】

    可通过CSS3 @keyframes配合transform实现持续旋转动画,具体包括定义rotate360关键帧、应用animation属性、结合JavaScript动态控制、优化timing-function及移动端适配。 如果您希望让HTML5页面中的某个元素实现持续旋转的动画效果,则可以通过C…

    2026年5月10日
    100
  • 什么是CSS优先级

    什么是CSS优先级什么是CSS优先级什么是CSS优先级什么是CSS优先级

    所谓CSS优先级,即是指CSS样式在浏览器中被解析的先后顺序;浏览器是通过优先级来判断哪些属性值与元素最相关以决定并应用到该元素上的。优先级就是分配给指定的CSS声明的一个权重,它由匹配的选择器中的每一种选择器类型的数值决定。 本教程操作环境:windows7系统、CSS3版、Dell G3电脑。 …

    2026年5月10日 用户投稿
    000

发表回复

登录后才能评论
关注微信