• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >html5 > 基于纯CSS3的6种手绘涂鸦按钮效果

基于纯CSS3的6种手绘涂鸦按钮效果

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-03

本文主要包含CSS3,按钮效果,涂鸦代码等相关知识,匿名希望在学习及工作中可以帮助到您
简要教程

  这是一组非常有趣的纯CSS3手绘风格卡通按钮设计效果。这组手绘风格按钮共6种不同的效果,它们以手绘涂鸦的方式,以不同的按钮边框线条宽度和虚线来构成按钮,效果非常不错。

使用方法

 HTML结构

该手绘风格卡通按钮的HTML结构就是使用一个按钮<button>元素,配以不同的class类来实现不同的手绘风格按钮。

<section>
  <button class='lined thick'>Lined Thick</button>
  <button class='dotted thick'>Dotted Thick</button>
  <button class='dashed thick'>Dashed Thick</button>
</section>

CSS样式

在这个DEMO中,整个页面以flexbox进行布局。页面字体使用的是一种手绘风格的谷歌字体。

@import url(https://fonts.googleapis.com/css?family=Patrick+Hand+SC);
html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  background: #F0F0D8;
  font-family: 'Patrick Hand SC', cursive;
}
html section, body section {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
      -ms-flex-direction: row;
          flex-direction: row;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  width: 100%;
  min-height: 100%;
  margin-bottom: 3rem;
}

所有的按钮的背景色都设置为透明,通过padding来设置按钮的尺寸,并为按钮设置一些阴影效果和圆角效果。还为按钮指定0.5秒的ease效果的过渡动画。

html section button, body section button {
  -webkit-align-self: center;
      -ms-flex-item-align: center;
          align-self: center;
  background: transparent;
  padding: 1rem 1rem;
  margin: 0 1rem;
  -webkit-transition: all .5s ease;
  transition: all .5s ease;
  color: #41403E;
  font-size: 2rem;
  letter-spacing: 1px;
  outline: none;
  box-shadow: 20px 38px 34px -26px rgba(0, 0, 0, 0.2);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
}

上面的圆角设置等价于下面的代码:

border-top-left-radius: 255px 15px;
border-top-right-radius: 15px 225px;
border-bottom-right-radius: 225px 15px;
border-bottom-left-radius:15px 255px;

然后分别为6种不同的手绘风格按钮的指定各自的边框样式。

html section button.lined.thick, body section button.lined.thick {
  border: solid 7px #41403E;
}
html section button.dotted.thick, body section button.dotted.thick {
  border: dotted 5px #41403E;
}
html section button.dashed.thick, body section button.dashed.thick {
  border: dashed 5px #41403E;
}
html section button.lined.thin, body section button.lined.thin {
  border: solid 2px #41403E;
}
html section button.dotted.thin, body section button.dotted.thin {
  border: dotted 2px #41403E;
}
html section button.dashed.thin, body section button.dashed.thin {
  border: dashed 2px #41403E;
}

在鼠标滑过按钮时,修改按钮的阴影效果。

html section button:hover, body section button:hover {
  box-shadow: 2px 8px 4px -6px rgba(0, 0, 0, 0.3);
}

最后,使用媒体查询来制作在小屏幕上的布局效果。

@media (max-width: 620px) {
  body h1 {
    margin-top: 2rem;
  }
  body section {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
        -ms-flex-pack: center;
            justify-content: center;
    margin-bottom: 1rem;
  }
  body section button {
    -webkit-align-self: center;
        -ms-flex-item-align: center;
            align-self: center;
    margin-bottom: 2rem;
  }
}

以上就是基于纯CSS3的6种手绘涂鸦按钮效果的内容,更多相关内容请关注微课江湖()!

相关文章:

如何使用html5与css3完成google涂鸦动画

基于javascript html5 canvas实现可调画笔颜色/粗细/橡皮的涂鸦板

Html5简单实现涂鸦板的示例代码

您可能想查找下面的文章:

  • 纯HTML5+CSS3制作生日蛋糕(代码易懂)
  • 浅谈html5标签css3的常用样式
  • HTML5+CSS3实现机器猫
  • CSS3 画基本图形,圆形、椭圆形、三角形等
  • 浅谈HTML5 & CSS3的新交互特性
  • HTML5和CSS3实例教程总结(推荐)
  • 关于老式浏览器兼容HTML5和CSS3的问题
  • html5+css3进度条倒计时动画特效代码【推荐】
  • HTML5+CSS3绘制锯齿状的矩形
  • 推荐WEB开发者最佳HTML5和CSS3代码生成器

相关文章

  • 2018-12-03HTML5 CANVAS:绘图状态和状态栈
  • 2018-12-03HTML5/CSS3 经典案例-无插件拖拽上传图片(一)
  • 2018-12-03为什么有些网页一开始不显示内容,等不耐烦了关掉的时候却显示了内容一闪而过?
  • 2017-08-06html5使用canvas画空心圆与实心圆
  • 2018-12-03HTML5中Viewport的参数介绍以及使用方法
  • 2017-08-06如何在网站上添加谷歌定位信息
  • 2017-08-06详解HTML5中的<template>标签
  • 2018-12-03html5教程调用绘图api画简单的圆形代码分享_html5教程技巧
  • 2017-08-06Html5大文件断点续传实现方法
  • 2018-12-03用html5绘制折线图的实例代码_html5教程技巧

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • HTML5 canvas画矩形时出现边框样式不一致的解决方法_html5教程技巧
    • iOS webView怎样加载HTMLString
    • H5 是什么?
    • html5的canvas实现3d雪花飘舞效果_html5教程技巧
    • h5页面如何调用摄像头代码分享
    • 基于HTML5 audio元素播放声音jQuery小插件
    • 为什么把 Script 标签放在 body 结束标签之后 html 结束标签之前?
    • HTML5+CSS3:3D展示商品信息示例
    • 移动端如何实现自适应所有设备?
    • 2015年web前端开发行业的牛人有哪些?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有