Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Tailwind CSS の小話「コンテナークエリーって便利」
Search
Yuki Yamada
May 14, 2025
Technology
570
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tailwind CSS の小話「コンテナークエリーって便利」
2025/05/14 シネマ de LT会〜あなたのナレッジ大上映〜のLTスライドです
Yuki Yamada
May 14, 2025
Other Decks in Technology
See All in Technology
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
夫婦で子育てするための育児標準化
codmoninc
PRO
0
330
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
490
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
160
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
220
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
150
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
150
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
110
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
420
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Visualization
eitanlees
153
17k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
Transcript
Tailwind CSS の小話 「コンテナークエリーって便利」 CSSの進化を刮目せよ
自己紹介📝 名前:やまだゆうき Twitter:@wf_o4 所属:SIerで働いてます 普段の業務内容 生成AIのアプリケーション開発をしています 得意な技術領域 Webフロントエンド、Azure、Python
自然言語処理(NLP) 2
今日、伝えたいこと 📢 • Tailwind CSS v4 からサポートされたコンテナークエリーが便利 3
コンテナークエリー メディアクエリーの代替となるもので、親要素を基準にスタイルを設定できる CSSの機能 4 画像出典元URL: https://developer.mozilla.org/ja/docs/Web/CSS/CSS_containment/Container_queries
コンテナークエリーとTailwind CSS コンテナークエリーはTailwind CSS では v4 から標準でサポート (v3まではプラグインが必要) 5
<div class="@container"> <div class="flex flex-col @md:flex-row"> <!-- ... --> </div> </div> 基準となる要素 基準となる要素が28rem (448px)以上の場合のス タイル設定
コンテナークエリーで何が嬉しいか コンテナークエリーはメディアクエリーと異なり画面サイズではなく 親要素を基準にできるのでコンポーネントベースの実装と相性が良い 6 コンポーネント自身のサイズでスタイリング
応用例 7
応用例)全体のレイアウトの把握 8 全体のレイアウトは Gridで構成
応用例)グリッドを構成する要素の特徴の把握 9 Grid内の最初の要素 (:first-child)
応用例)作成するコンポーネントの把握 10 コンテナークエリーで 同一のコンポーネントと して実装
応用例)コンポーネントの実装 ❖ ArticleCardコンポーネントの実装 11 <div class="@container overflow-hidden rounded-xl bg-white
shadow"> <div class="block grid-cols-3 @lg:grid "> <img :src="imgSrc" :alt="alt" class="block w-full" /> <div class="col-span-2 p-4"> <h2 class="font-semibold text-gray-800">{{ title }}</h2> <div class="mt-2 line-clamp-4 text-sm text-gray-500 @lg:line-clamp-none "> {{ description }} </div> </div> </div> </div>
応用例)擬似クラス :first-child の利用 ❖ グリッド側の実装 12 <div class="grid grid-cols-4
gap-4"> <article-card class="first:col-span-4 " v-for="item in items" :key="item.id" :imgSrc="item.imgSrc" :title="item.title" :description="item.description" /> </div> Tailwind CSS では :first を 使うことで擬似クラス :first-child の スタイリングが可能
まとめ • Tailwind CSS v4 からサポートされたコンテナークエリーが便利 • CSSの進化が凄い ◦
従来は JavaScript を使って制御していたようなレイアウトもCSS単 体で実現できるようになっている ◦ Tailwind CSS を使っていると CSS のキャッチアップにもなる 13