20200315のCSSに関する記事は7件です。

【CSS】読み込み時にスライドされhover時に灰色のフィルタがかかり拡大するアニメーション

udemy動画内容のメモ・備忘録

index.html
<div class="cover-slide hover-darken inview">
  <img class="img-zoom" src="images/image-1.jpg" alt="">
</div>
style.scss
@import 'mixin';

img {
  max-width: 100%;
  vertical-align: bottom;
}

.cover-slide {
  position: relative;
  overflow: hidden;

  &::after {
    content: '';
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #eaebe6;

    @include animation(
      $name: kf-cover-slide
    );
  }
  &.inview {
    &::after {
      @include animation(
        $name: kf-cover-slide,
        $duration: 1.6s,
        $timing-function: ease-in-out,
        // $fill-mode: normal
      );
    }
  }
}

@keyframes kf-cover-slide {
  0% {
    left: 0;
    right: 100%;
  }
  50% {
    left: 0;
    right: 0;
  }
  100% {
    left: 100%;
    right: 0;
  }
}

.img-zoom {
  opacity: 0;

  .inview & {
    opacity: 1;
    transition: transform 0.3s ease;
    @include animation(
      $name: kf-img-show,
      $duration: 1.6s,
      $timing-function: ease-in-out,
      $fill-mode: normal
    );

    &:hover {
      transform: scale(1.1);
    }
  }
}

@keyframes kf-img-show {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0;
  }
  50.1% {
    opacity: 1;
    transform: scale(1.5);
  }
  100% {
    opacity: 1;
  }
}

.hover-darken {
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: backgorund-color 0.3s ease;
    pointer-events: none;

    @include animation(
      $name: kf-img-show,
      $duration: 1.6s,
      $timing-function: ease-in-out,
      $fill-mode: normal
    );
  }
  &:hover::before {
    background-color: rgba(0, 0, 0, 0.4);
  }
}
_mixin.scss
@mixin animation(
  $name,
  $duration: 1s,
  $timing-function: ease,
  $delay: 0s,
  $iteration-count: 1,
  $direction: normal,
  $fill-mode: forwards
) {
  animation: {
    name: $name;
    duration: $duration;
    timing-function: $timing-function;
    delay: $delay;
    iteration-count: $iteration-count;
    direction: $direction;
    fill-mode: $fill-mode;
  }
}
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

画面外の色を黒くしたい!(CSS)

個人アプリでシックな高級感のある感じを出したいと思い、黒基調の動画サイトを作成しています。

デフォルトだと画面外にスクロールすると端が白くなってしまいますが、
下記を追加するだけで他の色に簡単に変えられます!

○○.css
html {
  background-color: black;
}

簡単ですね(笑)
是非試してみてください。

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

20 CSS Color Palettes for Web Developers

Color is an essential part of design. And choosing the perfect color scheme is a step all web designers, must go through.

Below are 20 CSS Color Palettes for Web Developers.

1.GRADIENTS COLLECTION PREVIEW

Used CSS variables and flexbox.

Made with

HTML (Pug) / CSS (SCSS)

Author

MenSeb

Demo

See the Pen Gradients Collection Preview by MenSeb (@MenSeb) on CodePen.


2.COLOR PALETTES

Color palettes with Flexbox.

Made with

HTML / CSS

Author

Linda Labancz

Demo

See the Pen Color palettes with Flexbox (study 2) by Linda Labancz (@marlasdaughter) on CodePen.


3.CSS GRID: COLOR PALETTE

Color palette that can be used in a real use case.

Made with

HTML (Pug) / CSS (SCSS)

Author

Olivia Ng

Demo

See the Pen CSS Grid: Color Palette by Olivia Ng (@oliviale) on CodePen.


4.GRADIENT COLLECTION

A small collection of gradients.

Made with

HTML (Pug) / CSS (PostCSS)

Author

Tamino Martinius

Demo

See the Pen Gradient Collection by Tamino Martinius (@Zaku) on CodePen.


5.DUOTONE FILTERING WITH CSS VARIABLES

Was playing with mix-blend-mode to create different duotone filters. Then I thought it might be cool to have a handy selector wheel to try out different filters. So here it is! A duotone filtering tester using CSS variables. The inner ring is the lightening color whilst the outer is the darkening color. To change the colors, adjust the colors variable in the Pug code.

Made with

HTML (Pug) / CSS (Stylus) / JavaScript

Author

Jhey

Demo

See the Pen Duotone filtering w/ CSS variables ?? by Jhey (@jh3y) on CodePen.


6.COLOR PALETTE

Color palette using CSS Grid.

Made with

HTML / CSS (SCSS)

Author

Joshua Ward

Demo

See the Pen Color Palette by Joshua Ward (@joshuaward) on CodePen.


7.AUTO COLOR PALETTE FORMATTING

Add/Edit/Remove Hex Colors from the array to update the palette.

Made with

CSS (SCSS) / JavaScript

Author

Tony Banik

Demo

See the Pen Auto Color Palette Formatting by Tony Banik (@banik) on CodePen.


8.BOOTSTRAP 4 COLOR PALETTE GENERATOR. INCLUDING COLOR VARIANTS

Bootstrap 4 color palette generator. Generates color variants from Bootstrap $colors i.e: .text-indigo-600 .bg-indigo-600 .border-indigo-600.

Made with

HTML/Haml
CSS/SCSS

Author

Gilles Migliori

Demo

See the Pen Bootstrap 4 Color Palette Generator by Gilles Migliori (@migli) on CodePen.


9.COLOR PALETTE

Pure CSS color palette.

Made with

HTML
CSS/SCSS

Author

Joshua Ward

Demo

See the Pen Color Palette by Joshua Ward (@joshuaward) on CodePen.


10.COLOR PALETTE

Color palette with CSS flexbox.

Made with

HTML
CSS

Author

Diana Choi

Demo

See the Pen Flexbox - Color Palette by Diana Choi (@dianachoi) on CodePen.


11.Color Wheel

Color wheel with HTML, CSS and JavaScript.

Made with

Html
Css/SCSS
Javascript

Author

thepheer

Demo

See the Pen Color Wheel by Jake Weary (@thepheer) on CodePen.


12.Color Palette Circles

Circles are nested SVG circles. They are generated by Jade loops (for easy tweaking). Flexbox lays them out in an even row. They are colorized via palettes from the COLOURlovers API.

Made with

Html
Css/SCSS
Javascript

Author

Chris Coyier

Demo

See the Pen Color Palette Circles by Chris Coyier (@chriscoyier) on CodePen.


13.Color Palettes With Shades

Color palettes with shades in HTML, CSS and JavaScript. Palettes: Windows Phone, Tango Desktop Project, Fedora, Open Suse, Jack Production, iOs 7, Pantone Spring 2016.

Made with

Html
Css/SCSS
Javascript

Author

Alessandro

Demo

See the Pen Color Palettes with shades by Alessandro (@afranceschetti) on CodePen.


14.Pantone Color Search + Clipboard

Pantone color search with clipboard in HTML, CSS and JavaScript.

Made with

Html
Css/SCSS
Javascript

Author

Mike Weaver

Demo

See the Pen Vue Pantone Color Search + Clipboard by Mike Weaver (@mjweaver01) on CodePen.


15.Random Color Palette Generator

Added ability to toggle between light and dark background colors.

Made with

Html
Css/SCSS
Javascript

Author

Giana

Demo

See the Pen Random Color Palette Generator by Giana (@giana) on CodePen.


16.Color Palettes

Click on the button to view a random color palette.

Made with

Html
Css/SCSS
Javascript

Author

Screeny

Demo

See the Pen Color Palettes by Screeny (@screeny05) on CodePen.


17.Color Palette

Click the color code to change the color!

Made with

Html
Css/SCSS
Javascript

Author

Philipp

Demo

See the Pen color palette by Philipp (@phbo) on CodePen.


18.Generate Palettes From An Image

This tool will let you drop an image and generate palettes from its top 100 colors (by surface area), and output it for use in CSS, iOS (Objective-C & Swift), Android (Java), etc.

Made with

Html
Css/SCSS
Javascript

Author

Blixt

Demo

See the Pen Generate palettes from an image by Blixt (@blixt) on CodePen.


19.Flattastic Pro Color Palette

This pen is an HTML/CSS version of the dribbble Flattastic Pro Color Palette by Erigon.

Made with

Html
Css

Author

Marcos Rodrigues

Demo

See the Pen Flattastic Pro Color Palette by Marcos Rodrigues (@rodriguesmarcos) on CodePen.


20.Color Palette

Color swatches with hex values on click, actively selected and available to copy.

Made with

Html
Css/SCSS
Javascript

Author

Louis Coyle

Demo

See the Pen Colour Palettes by Louis Coyle (@dropside) on CodePen.

参照元リンク : 20 CSS Color Palettes for Web Developers – Jquery Plugins Free

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Makrdownの表内フォントサイズを変更する方法

Markdownで、表内のフォントサイズを変更する方法を調べたので備忘録として。

<style>
table, th, td {
    font-size: 50%;
}
</style>

とかMarkdownファイル内に書いておけばフォントサイズは変わるのであるが、
これだけだと、Markdown内の全部の表に適用されてしまう。
個別適用したいこともあるかもしれないので、その場合は子要素セレクタを使って以下のようにする。

<style>
.smalltable > table, .smalltable > th, .smalltable > td {
    font-size: 50%;
}
</style>

上記は、smalltable というクラスの子要素になっている table ではフォントサイズを 50% にするっていう意味。

試しに以下のように記述する

Tableのフォントサイズ変更のサンプル

<style>
.smalltable > table, .smalltable > th, .smalltable > td {
   font-size: 50%;
}
</style>

<div class="smalltable"> 

表1
|  TH  |  TH  |
| ---- | ---- |
|  TD  |  TD  |
|  TD  |  TD  |

</div>

表2
|  TH  |  TH  |
| ---- | ---- |
|  TD  |  TD  |
|  TD  |  TD  |

Tableのフォントサイズ変更のサンプル

VSCodeのプレビューでは反映されたけど、Qiita, Githubだと効いてない...

一応VSCodeでのキャプチャ
markdownで表のフォントサイズ変更.png

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Tabulatorでツールチップをカスタマイズしてみた

前提条件

http://tabulator.info/  ⇒ V4.5

内容

Tabulatorでツールチップを実装するのは簡単だが
カスタマイズしたい機会があったので備忘録として。
(Tabulatorの標準ツールチップ機能はカスタマイズができない。。。)

参考

https://so-zou.jp/web-app/tech/programming/javascript/event/handler/mouse/
http://tabulator.info/

実装

・標準のツールチップ
ツールチップの実装はここを参考に
http://tabulator.info/docs/4.5/format#tooltips

    var table = new Tabulator("#example-table", {
      height: 205,
      data: table_data,
      layout: "fitColumns",
      columns: [
        {
          title: "Name", field: "name", width: 64,
          // これだけでツールチップが実装される
          tooltip: true
        },
        { title: "Age", field: "age", align: "left", formatter: "progress" },
        { title: "Favourite Color", field: "col" },
        { title: "Date Of Birth", field: "dob", sorter: "date", align: "center" },
      ],
    });




・ツールチップのカスタマイズ
※jQueryを導入しています。

ツールチップ用のタグを追加

  <!-- Bodyの中に追記 -->
  <div class="tabulator-tooltip">
    <table class="tooltip-style">
      <tr>
        <td id="tabulator-tooltip-value"></td>
      </tr>
    </table>
  </div>
  <!--  -->



headタグにCSSを追記
※ もちろん別ファイルに追記でOK

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Tabulator-test</title>
  <style>
    /* ここを新規に追加 */
    .tabulator-tooltip {
      opacity: 0;
      background-color: #fff;
      min-width: 150px;
      width: auto;
      height: auto;
      position: absolute;
      max-width: 330px;
      border-radius: 5px;
      padding: 10px;
      color: black;
      border: 1px solid black;
    }
  </style>
</head>



先ほどのTabulatorの生成コードを変更

    var table = new Tabulator("#example-table", {
      height: 205,
      data: table_data,
      layout: "fitColumns",
      tooltips: function (cell) {
        var cellElement = $(cell.getElement());
        cellElement.on('mouseover', function () {
          $('.tabulator-tooltip #tabulator-tooltip-value').text(cell.getValue());
        });
        cellElement.on('mousemove', function (e) {
          $('.tabulator-tooltip').css('opacity', 1);
          $('.tabulator-tooltip').css('left', e.pageX + 30 + 'px');
          $('.tabulator-tooltip').css('top', e.pageY - 10 + 'px');
        });
        cellElement.on('mouseleave', function (e) {
          $('.tabulator-tooltip').css('opacity', 0);
        });
        return '';
      },

      columns: [
        {
          title: "Name", field: "name", width: 64,
        },
        { title: "Age", field: "age", align: "left", formatter: "progress" },
        { title: "Favourite Color", field: "col" },
        { title: "Date Of Birth", field: "dob", sorter: "date", align: "center" },
      ],
    });



完成♪
これでCSSを変えれば、カスタマイズとフォントサイズとかを変えれる
image.png

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

僕のCSS

自分用の備忘録

基本の形

@charset "UTF-8";
セレクタ{
    プロパティ:値
}
セレクタ別指定の仕方
要素名{}
.class{}
#id{}
セレクタ1 > セレクタ2{}  /*子セレクタ*/
セレクタ1 セレクタ2{}  /*子孫セレクタ*/
セレクタ1, セレクタ2{}/*複数の要素に*/
セレクタの優先順位

1:!important
2:タグのstyle属性
3:idセレクタ
4:classセレクタ
5:要素セレクタ
6:全称セレクタ *{}ってやつ
7:ブラウザ初期値

設定

  • backgroud:背景
    • backgroud:url(../img.jpg) no-repeat center center/cover
  • background-color:背景色
  • border-bottom:下線
  • color:文字色
  • display:表示形式
    • block
  • font-family:字体
  • font-size:文字サイズ
    • rem
    • px
  • font-weight:文字の重さ
  • left:左の位置
  • line-height:行の高さ。1.0とか2.0とか
  • margin
  • margin-bottom:下の外余白
  • max-width:最大幅の指定。
  • padding:内余白
  • position:要素の位置
    • static:初期指定。特に位置指定なし。
    • relative:staticを指定したときの位置が基準位置。
    • absolute:親要素がstatic以外の時に親要素の左上が基準になる。
    • fixed:基本はabsoluteと同じだけど。スクロールしても固定される。
  • text-align:文字揃え
  • top: 上の位置
  • transform:要素の位置を移動。
    • translate(0,-50%):元の位置から要素の高さ50%分上に移動
  • width :幅
    • px
    • % 
  • z-index:要素を重ねて表示する際の優先順位を指定。数字大きい方が上。

フォントサイズ

CSSのfont-sizeが%とかemとかremとかvwで指定されてると、ビビっちゃう君と僕を救う2分

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

初心者によるプログラミング学習ログ 260~262日目

100日チャレンジの260~262日目

twitterの100日チャレンジ#タグ、#100DaysOfCode実施中です。
すでに100日超えましたが、継続。
100日チャレンジは、ぱぺまぺの中ではプログラミングに限らず継続学習のために使っています。
260~262日目は、

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む