基于纯CSS3的6种手绘涂鸦按钮效果
简要教程
这是一组非常有趣的纯CSS3手绘风格卡通按钮设计效果。这组手绘风格按钮共6种不同的效果,它们以手绘涂鸦的方式,以不同的按钮边框线条宽度和虚线来构成按钮,效果非常不错。
使用方法
HTML结构
该手绘风格卡通按钮的HTML结构就是使用一个按钮
<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种手绘涂鸦按钮效果的内容,更多相关内容请关注PHP中文网(www.php.cn)!
相关文章:

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









純粋な CSS3 で波の効果を実現するにはどうすればよいですか?この記事ではSVGとCSSアニメーションを使って波のエフェクトを作成する方法をご紹介しますので、お役に立てれば幸いです。

この記事では、頻繁に登場する様々な奇妙な形のボタンをCSSを使って簡単に実現する方法を紹介しますので、ぜひ参考にしてください。

2 つの方法: 1. display 属性を使用して、要素に「display:none;」スタイルを追加するだけです。 2. Position 属性と top 属性を使用して、要素の絶対位置を設定し、要素を非表示にします。要素に「position:absolute;top:-9999px;」スタイルを追加するだけです。

CSS では、border-image 属性を使用してレースの境界線を実現できます。 border-image 属性では、画像を使用して境界線を作成できます。つまり、境界線に背景画像を追加できます。背景画像をレース スタイルとして指定するだけで済みます。構文「border-image: url (画像パス) は、内側への画像境界線の幅。開始を繰り返すかどうか;"。

実装方法: 1. ":active" セレクターを使用して、画像上のマウス クリックの状態を選択します; 2. 変換属性とscale() 関数を使用して、画像の拡大効果を実現します。構文 "img:active {transform : スケール(x 軸倍率、y 軸倍率);}"。

テキストカルーセルと画像カルーセルを作成するにはどうすればよいですか?皆さんが最初に考えるのはjsを使うかどうかですが、実はテキストカルーセルや画像カルーセルも純粋なCSSでも実現できますので実装方法を見ていきましょう。

CSS3 では、「animation-timing-function」属性を使用してアニメーションの回転速度を設定できます。この属性は、アニメーションがサイクルを完了する方法を指定し、アニメーションの速度曲線を設定するために使用されます。構文は「element {アニメーションタイミング関数: 速度属性値;}"。

css3 のアニメーション効果には変形があり、「animation: アニメーション属性 @keyframes ..{..{transform: 変換属性}}」を使用して変形アニメーション効果を実現できます。アニメーション属性はアニメーション スタイルを設定するために使用され、変形スタイルを設定するには、transform 属性を使用します。
