タグ

articleとCSSに関するefclのブックマーク (178)

  • アニメーションの実装が劇的に簡単になるFLIPテクニック - Katashin .info

    2023年7月10日CSS,JavaScript,アニメーション,デザインパターンアニメーションの実装はややこしいからCSS Transitionでできなければ実装したくない、そう思っていませんか?FLIPというテクニックを使うことで、CSS Transitionだけでは実装できないケースでも簡単にアニメーションを実装することができます。 FLIPとは #FLIP とは First, Last, Invert, Play の頭文字から取られた用語であり、アニメーションをこの4つのステップに分割して行うテクニックです。例えば、以下のようなリストの項目に追加、削除、並べかえができるUIに対して、簡単にアニメーションを付けることができます。 上のデモで追加、削除、並べかえを行った時に、項目の座標移動がアニメーションすることがわかると思います。これは CSS Transition だけでは実装する

    アニメーションの実装が劇的に簡単になるFLIPテクニック - Katashin .info
    efcl
    efcl 2023/07/12
    FLIP(First, Last, Invert, Play)というアニメーションのテクニックについて。 複雑な座標計算をせずにアニメーションを実装する方法。
  • Cyclic Dependency Space Toggles

    Cyclic Dependency Space TogglesOver the past few years, I wanted to be able to select a value from a list in CSS by toggling a single custom property. We have the “space toggle” for booleans, and hopefully, one day, we’ll get style queries, but what about today? In this article, I present you with the technique I recently discovered. The Technique Let me startGo to a sidenote by showing you the co

    efcl
    efcl 2023/06/22
    CSS Variablesを使ってロジックゲートを実装する方法について。 循環参照するVariablesは無効となる仕様を利用し、Variablesにif文的な切り替えを実装する方法について。またなぜこのような仕様と実装になったのかについて
  • Best practices for container queries | Zell Liew

    (Hey, we're having problems showing images in RSS right now, so if you want a better reading experience, consider viewing this article online [here](https://zellwk.com//blog/container-queries-best-practice. We hope to fix this soon!). I've been playing around with container queries and so far, there is only one best practice that I would recommend. Whenever you use container queries, make sure you

    efcl
    efcl 2023/06/17
    Container Queryを使う場合は、.containerだけをコンテナ要素を囲む
  • Modern CSS For Dynamic Component-Based Architecture | Modern CSS Solutions

    Modern CSS For Dynamic Component-Based Architecture Updated on: Jan 19, 2024 Written by Stephanie Eckles The language of CSS has had an explosion of new features and improvements in the last few years. As a result, feature parity between browsers is at an all-time high, and efforts are being made to continue releasing features consistently and synchronously among evergreen browsers. Today, we will

    Modern CSS For Dynamic Component-Based Architecture | Modern CSS Solutions
    efcl
    efcl 2023/06/17
    モダンなCSSを使ったコンポーネントベースのアーキテクチャについて。 `@layer`を使ったLayout、`:has()`やCustom Propertiesを使ったVariants。 `@container style()`を使ったスタイルの条件分岐、Container QueryとMedia Queryによるブレークポイン
  • Modern CSS in Real Life

    Hey! Chris Coyier here. This is a blog-itized version of a presentation I created. It started life as a Keynote file which I presented in person at RenderATL in June of 2023. I put a lot of work into it! I’m so grateful to everyone who came and saw it. But you can’t beat the reach of websites! I decided I should get some more mileage out of it by sharing it here in an adapted form. I suppose you s

    Modern CSS in Real Life
    efcl
    efcl 2023/06/11
    モダンなCSSの機能についてのスライドと解説。 Logical Properties、Container Queries、Cascade Layers、CSS Colorsと`oklch()`、View Transitions APIについて
  • HTML 全体の CSS を取得して Shadow DOM に適用する

    以下のコードで HTML 全体の CSS を取得して Shadow DOM に適用することができます。 最近まで replaceSync() と adoptedStyleSheets() の存在を知らなかったのですが、 この 2つを使うと毎回 style タグを書き出すより効率的に処理できるらしい。 これまで Shadow DOM の中に link タグを書くような方法を使っていたのですが、link タグだと最適化がしにくい問題があります。 CSS はインライン化したほうが高速なので、その時にも同じように使える方法が欲しかったのですが、この方法でいけるとわかりました。 document.styleSheets も知らなかった…。 function getGlobalCSS() { let cssText = ""; for (const stylesheet of document.sty

    efcl
    efcl 2023/06/10
    `document.styleShets`からスタイルを集めて`replaceSync`でスタイルシートを作り、`shadowRoot.adoptedStyleSheets`でスタイルシートを当てる方法について。
  • CSS Custom Properties Beyond the :root · Matthias Ott – User Experience Designer

    Manuel asked: Is there a good reason why we’re defining global custom properties on :root/html and not on body?” It’s a great question: Everybody just seems to define most of their global custom properties (aka CSS variables) on the :root selector without giving it a second thought – and so am I. But why :root? The answer is that there is no real reason. It’s just a convention. Defining custom pro

    CSS Custom Properties Beyond the :root · Matthias Ott – User Experience Designer
    efcl
    efcl 2023/04/27
    なぜ`:root`でCSS Custom Propertyを定義するのかについて
  • CSS update Media Query  |  CSS and UI  |  Chrome for Developers

    Build with Chrome Learn how Chrome works, participate in origin trials, and build with Chrome everywhere.

    efcl
    efcl 2023/04/27
    `update` Media Queryについて。 デバイスのリフレットレートが`fast`/`slow`/`none`かを判定したスタイルを書ける。
  • CSS text-wrap: balance  |  CSS and UI  |  Chrome for Developers

    Try a demo Without text-wrap: balance; designers, content editors and publishers have few tools to change the way lines are balanced.. The best options available being to use <wbr> or &shy; to help guide text layouts into smarter decisions about where to break lines and words. As a developer, you don't know the final size, font size, or even language of a headline or paragraph. All the variables n

    efcl
    efcl 2023/04/04
    Chromeにフラグ付きで実装されているCSS `text-wrap: balance`について。 テキストブロックの改行位置を調整するタイポグラフィ用のプロパティ
  • Everything You Need To Know About The Gap After The List Marker | CSS-Tricks

    DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit! I was reading “Creative List Styling” on Google’s web.dev blog and noticed something odd in one of the code examples in the ::marker section of the article. The built-in list markers are bullets, ordinal numbers, and letters. The ::marker pseudo-element allows us to style these markers or re

    Everything You Need To Know About The Gap After The List Marker | CSS-Tricks
    efcl
    efcl 2023/03/11
    CSSの`::marker`擬似要素について
  • Try out CSS Nesting today

    Back in December, we wrote an article detailing three different options for CSS Nesting. In it, we explained the differences between Option 3, Option 4 and Option 5, demonstrating how each would work through a series of examples. Then we asked a simple question: “Which option is best for the future of CSS?” Web developers responded to the poll with great clarity. Option 3 won in a landslide. And s

    efcl
    efcl 2023/02/20
    CSS NestingがSafari Technology Previewで利用できるようになったため、使い方についての紹介記事
  • The truth about CSS selector performance

    If you’re a web developer, you may have already heard that some CSS selectors are faster than others. And you’re probably hoping to find a list of the better selectors to use in this article. Well, not quite. But bear with me, I promise that by the end, you’ll have learnt something new about CSS selector performance. A quick look behind the scenes The way you write CSS selectors does play a role i

    The truth about CSS selector performance
    efcl
    efcl 2023/02/19
    MSEdgeのCSSセレクタのパフォーマンス分析機能について
  • My talk on CSS runtime performance

    17 Jan My talk on CSS runtime performance Posted January 17, 2023 by Nolan Lawson in performance, Web. 3 Comments A few months ago, I gave a talk on CSS performance at performance.now in Amsterdam. The recording is available online: (You can also read the slides.) This is one of my favorite talks I’ve ever given. It was the product of months (honestly, years) of research, prompted by a couple ques

    My talk on CSS runtime performance
    efcl
    efcl 2023/02/19
    CSSのRuntime Performanceについての動画。 CSS Selectorの動作とコスト、レイアウトのパフォーマンスとCSS Containment、デバッグ方法について
  • CSS Custom Highlight API: A First Look | CSS-Tricks

    DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit! Styling ranges of text in software is a very useful thing to be able to do. Thankfully, we have the CSS Custom Highlight API to look forward to because it represents the future of styling text ranges on the web. One example: if you’ve ever used text editing software like Google Docs, Word, o

    CSS Custom Highlight API: A First Look | CSS-Tricks
    efcl
    efcl 2023/02/08
    `Highlight`でのSelection/Rangeのハイトライトについて
  • 次世代 CSS 仕様が与えるコンポーネント時代の Web への影響 | blog.jxck.io

    Intro SPA の隆盛で進化したフロントエンドライブラリによって生み出された「コンポーネント」という資産は、それを View 層の最小単位として扱うエコシステムにその重心をずらした。 近年の Web 開発は、虫いのテンプレートエンジンにデータをはめ込む方式から、デザインシステムにカタログされたコンポーネント群に、 API から取得したステートを流し込み、それらを「いつ、どこで、どう」レンダリングするかという課題への最適解を、各位が模索するフェーズとなっている。 コンポーネントを敷き詰めるコンテナ側の設計は、 Flexbox および Grid の登場によるレイアウトの進化が手助けしたところも多いにある。しかし、「ページ」を前提に設計された CSS は、「コンポーネント」を前提にした設計に移行するうえで、ミッシングピースが多かった。 現在、提案/実装が進んでいる CSS の新機能群には、

    次世代 CSS 仕様が与えるコンポーネント時代の Web への影響 | blog.jxck.io
    efcl
    efcl 2023/01/10
    最近実装されているCSSの新しい仕様について。 `@scope`, `@layer`, Nesting, `:is()`, `:where()`, `:has()`, `@container`などについて
  • そろそろカスケードレイヤー(@layer)と向き合う

    カスケードレイヤー@layerがモダンブラウザでサポートされたとはいえ、互換性の問題から、実際に現場で見かけるのは、まだまだ未来の話と思っていました。ふと、思い立ってCan I use... Support tables for HTML5, CSS3, etcを確認してみたところ、現時点(2022.12.27)でも、すでにGlobalで9割近くサポートされています。これは来年あたりから見かける機会が増えそうだと思ったので、そろそろカスケードレイヤーと向き合いたいと思います。 カスケードレイヤー@layer カスケードレイヤーはスタイルの優先順位を制御するためアルゴリズムの1つです。カスケードレイヤーを使用することで、スタイルの優先順位をレイヤー化(階層化)して管理することができます。とりわけ覚えておかなければならないのは、カスケードアルゴリズムは詳細度アルゴリズムよりも優先されるというこ

    そろそろカスケードレイヤー(@layer)と向き合う
    efcl
    efcl 2023/01/01
    CSSの@layerについての解説記事
  • Help choose the syntax for CSS Nesting

    The CSS Working Group is continuing a debate over the best way to define nesting in CSS. And if you are someone who writes CSS, we’d like your help. Nesting is a super-popular feature of tools like Sass. It can save web developers time otherwise spent writing the same selectors over and over. And it can make code cleaner and easier to understand. Unnested CSS .class1 { color: green; } .class1 .cla

    efcl
    efcl 2022/12/18
    CSSのネスト構文のProposalでどの構文がわかりやすいかというアンケートが実施されている
  • Find the most expensive CSS selectors

    When it comes to improving web rendering performance, we often spend time working on JavaScript code. But CSS has an important role to play too in how fast a web page renders. CSS selectors, in particular, can sometimes be slow for the browser engine to match to the DOM of the page, and this can become a big problem when the web page has a large DOM tree, a lot of CSS rules, and where the DOM chan

    Find the most expensive CSS selectors
    efcl
    efcl 2022/12/16
    MSEdgeのDevToolsで、CSSセレクタの処理時間やマッチ回数を見る方法について
  • CSSでスクロールバーの有無によるがたつきをなくす: Days on the Moon

    この記事はCSS Advent Calendar 2022の9日目の分です。 CSSのボックスモデルにおいては、ボーダーの内辺とパディングの外辺の間にスクロールバーが配置されます。最近はどのOSでもオーバーレイスクロールバー(スクロールバーが内容の前面に覆いかぶさるようなもの)が主流となり、スクロールバーが存在してもしなくても内容の幅が変わらないようになっています。一方、クラシックスクロールバー(スクロールバーが常に表示されるようなもの)が使われる環境では、overflow: autoな要素において内容がはみ出すときとはみ出さないときで内容の幅が変わってきます。 クラシックスクロールバーが使われる環境でも内容の幅を一定に保ちたいという場合は、scrollbar-gutterプロパティを使います。scrollbar-gutter: stableを指定すれば、スクロールバーが表示されないときで

    efcl
    efcl 2022/12/10
    scrollbar-gutter: stableでスクロールバーが出ない時も、スクロールバーと同じ幅を確保する
  • コードジャンプ可能な CSS Modules を実現する happy-css-modules の紹介 - mizdra's blog

    弊社では ReactCSS を書くための手法として CSS Modules を全面的に採用しています。そこで CSS Modules を使った開発をより快適にするために、「happy-css-modules」というツールを作りました。 happy-css-modules のデモ。 この記事ではこのツールが必要になった背景、導入方法、そしてツールの技術的な仕組みについて紹介します。 CSS Modules の問題点と、typed-css-modules による解決 CSS Modules では、デフォルトでは存在しないクラス名を使用しても、(プロジェクトの設定次第ですが) TypeScript のコンパイルエラーが出ることはありません。 import styles from './Button.module.css'; function Button() { return ( <but

    コードジャンプ可能な CSS Modules を実現する happy-css-modules の紹介 - mizdra's blog
    efcl
    efcl 2022/11/21
    Typed CSS Modulesとコードジャンプの問題について。 TypeScriptのDeclaration Mapを使い、型定義ファイルではなくソースコードであるCSSそのものへジャンプする実装について