10個Github上相見恨晚的CSS 奇技淫巧項目,幫你找到寫CSS的靈感!

You-need-to-know-css

img

  該項目是 CSS 的各類效果實現,尤爲是動畫效果。css

  筆者把本身的收穫和工做中經常使用的一些 CSS 小樣式總結成這份文檔。目前文檔一共包含 43 個 CSS 的小樣式(持續更新…),因此仍是很不錯的學習 CSS 的項目來的。html

img

好比: 打字效果前端

<style>
  main {
    width: 100%; height: 229px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  span {
    display: inline-block;
    width: 21ch;
    font: bold 200% Consolas, Monaco, monospace;   /*等寬字體*/
    overflow: hidden;
    white-space: nowrap;
    font-weight: 500;
    border-right: 1px solid transparent;
    animation: typing 10s steps(21), caret .5s steps(1) infinite;
  }
  @keyframes typing{
    from {
        width: 0;
    }
  }
  @keyframes caret{
    50% { border-right-color: currentColor}
  }
</style>
<template>
  <main class="main">
    <span>前端GitHub</span>
  </main>
</template>
<script>
</script>
https://lhammer.cn/You-need-t...

CSS-Inspiration

img

  這裏可讓你尋找到使用或者是學習 CSS 的靈感,以分類的形式,展現不一樣 CSS 屬性或者不一樣的課題使用 CSS 來解決的各類方法。vue

  包含了:佈局(Layout)、陰影(box-shadow、drop-shadow)、僞類/僞元素、濾鏡(fliter)、邊框(border)、背景/漸變(linear-gradient/radial-gradient/conic-gradient)、混合模式(mix-blend-mode/background-blend-mode)、3D、動畫/過渡(transition/animation)、clip-path、文本類、綜合、CSS-Doodle、SVG 等內容。react

好比:巧用 CSS 實現酷炫的充電動畫css3

img

https://github.com/chokcoco/C...

css_tricks

  該項目總結了一些經常使用的 CSS 樣式,記錄一些 CSS 的新屬性和一點奇技淫巧。好比提示氣泡的效果git

<div class="poptip btn" aria-controls="彈出氣泡">poptip</div>
$poptipBg: #30363d;
$color: #fff;
$triangle: 8px;
$distance: -12px;
.poptip {
  position: relative;
  z-index: 101;
  &::before,
  &::after {
    visibility: hidden;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: all 0.3s ease 0.2s;
    box-sizing: border-box;
  }
  &::before {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: $triangle $triangle 0 $triangle;
    border-color: $poptipBg transparent transparent transparent;
    left: calc(50% - #{$triangle});
    top: 0px;
    transform: translateX(0%) translateY($distance);
  }
  &::after {
    font-size: 14px;
    color: $color;
    content: attr(aria-controls);
    position: absolute;
    padding: 6px 12px;
    white-space: nowrap;
    z-index: -1;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%) translateY($distance);
    background: $poptipBg;
    line-height: 1;
    border-radius: 2px;
  }
  &:hover::before,
  &:hover::after {
    visibility: visible;
    opacity: 1;
  }
}
.btn {
  min-width: 100px;
  line-height: 1.5;
  padding: 5px 10px;
  color: #fff;
  background: #00adb5;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
}

效果:程序員

img

https://github.com/QiShaoXuan...

animista

  該項目裏面有各類 CSS 實現的效果,還有代碼演示,方便直接複製代碼,還能夠複製壓縮後的代碼,若是你在找某個 CSS 的效果的話,能夠到這裏找找看。github

img

img

http://animista.net/

spinkit

img

  聚集了實現各類加載效果的 CSS 代碼片斷。api

  SpinKit 僅使用(transformopacity)CSS 動畫來建立平滑且易於自定義的動畫。

https://tobiasahlin.com/spinkit/

十天精通 CSS3

  這是前端大佬大漠出的一個免費的 CSS3 教程,對於有必定 CSS2 經驗的夥伴,能讓您系統的學習 CSS3,快速的理解掌握並應用於工做之中。

  裏面的內容有講解,還有代碼演習,學完以後,能夠練習所學的 api ,真的很不錯。

img

  超級貓入門前端時,也學習過裏面的內容呢,雖然如今忘記的差很少了 😂,可是學過!。

https://www.imooc.com/learn/33

Animate

img

  這是一個有趣的,跨瀏覽器的 css3 動畫庫,內置了不少典型的 css3 動畫,兼容性好使用方便。

  animate.css 的使用很是簡單,由於它是把不一樣的動畫綁定到了不一樣的類裏,因此想要使用哪一種動畫,只須要把通用類 animated 和相應的類添加到元素上就好了。

  作爲一個前端開發,若是不知道這個庫就真的很失敗了。

https://animate.style/

sass

  Sass 是一種 CSS 的預編譯語言,Sass 爲 CSS 賦予了更強大的功能。它提供了 變量(variables)、嵌套(nested rules) [混合(mixins)、函數(functions)等功能,而且徹底兼容 CSS 語法。

  Sass 可以幫助複雜的樣式表更有條理, 而且易於在項目內部或跨項目共享設計。

https://sass.bootcss.com/docu...

less

  Less 是一門 CSS 預處理語言,它擴展了 CSS 語言,增長了變量、Mixin、函數等特性。Less 能夠運行在 Node 或瀏覽器端。

https://less.bootcss.com/

stylus

  富有表現力、動態、健壯的 CSS。它提供了一種高效,動態和表達方式來生成 CSS。同時支持縮進語法和常規 CSS 樣式。

https://stylus-lang.com/

  CSS 預處理器技術已經很是的成熟了,並且也涌現出了愈來愈多的 CSS 的預處理器框架。對於 sass 、less 和 stylus,都是在如今的 vue 和 react 項目中常常用到的,用法也很簡單,只要學會一種,其餘兩種都很容易上手,項目中用哪種就要看本身的喜歡了。

結尾

本期就分享到這裏,我是小編南風吹,專一分享好玩有趣、新奇、實用的開源項目及開發者工具、學習資源!
但願能與你們共同窗習交流,歡迎關注個人公衆號 【Github導航站】

往期推薦

太漂亮了!有了3款開源圖標庫,不用再去求設計師了

10個相見恨晚的vue.js庫!用好了,事半功倍!

太及時了!13個Spring Boot練手項目,用好了,升職漲薪不用愁

程序員接私活必備後臺框架,不用重複造輪子,網友:太好用了!

還在從頭至尾擼項目?這6個SpringBoot項目用好了,事半功倍!

「00後縮寫黑話翻譯器」登上GitHub熱榜,中年網民終於能看懂年輕人的awsl

相關文章
相關標籤/搜索