
ブログ
分解パンケーキ
これは、マーケティング サイトによく見られるレイアウトです。たとえば、3 つのアイテムが 1 行に並んでいて、通常は画像、タイトル、商品の特徴を説明するテキストが含まれています。小さい画面では、それらをきれいに積み重ね、画面サイズが大きくなるにつれて拡張する必要があります。 この効果に Flexbox を使用すると、画面のサイズ変更時にこれらの要素の配置を調整するためにメディアクエリを使用する必要がなくなります。 flex の省略形は flex: <flex-grow>
- HTML
- CSS
2024年12月21日
アスペクト比の画像カード
aspect-ratio プロパティを使用すると、カードのサイズを変更しても、緑色のビジュアル ブロックのアスペクト比は 16:9 のままになります。 aspect-ratio: 16 / 9 でアスペクト比を維持しています。 このプロパティを使用せずに 16 x 9 のアスペクト比を維持するには、 padding-top ハック を使用して 56.25% の余白を指定し、縦横比を設定する必要があります。まもなく、このプロパティが追加され、ハックや割合の計算が不要になります。 1 / 1
- HTML
- CSS
2024年12月21日
Container query card
This demo uses container queries to create an intrinsic, responsive card. The card goes from a single-column layout at more narrow sizes to a two-column layout when it is at wider sizes. To create the container, first set containment on the parent:
- HTML
- CSS
2025年2月27日
Gentle Flex
A centering technique that only aligns content and doesn't change their size during the process. See the full article for many more details about this technique and when it's efficient. Full article · Video on YouTube · Source on Github
- CSS
- HTML
2025年2月27日
Autobot
A centering technique where an element pushes equally from all edges of a flex container. Best for quick centering for single items only. See the full article for many more details about this technique and when it's efficient. Full article · Video on
- HTML
- CSS
2025年2月27日
Pancake stack
Unlike the deconstructed pancake, this example does not wrap its children when the screen size changes. Commonly referred to as a sticky footer, this layout is used for both websites and apps, across mobile applications (the footer is commonly a
- HTML
- CSS
2025年2月27日
Clamping card
In this demo, you are setting the width using clamp() like so: width: clamp(<min>, <actual>, <max>). This sets an absolute min and max size, and an actual size. With values, that can look like: The minimum size here is 23ch or 23
- CSS
- HTML
2025年2月27日
RAM (Repeat, Auto, Minmax)
For this seventh example, combine some of the concepts you've already learned about to create a responsive layout with automatically-placed and flexible children. Pretty neat. The key terms to remember here are repeat, auto-(fit|fill), and minmax(),
- CSS
- HTML
2025年2月27日
Holy grail layout
For this classic holy grail layout, there is a header, footer, left sidebar, right sidebar, and main content. It's similar to the previous layout, but now with sidebars! To write this entire grid using a single line of code, use the grid-template
- HTML
- CSS
2025年2月27日
Fluffy Center
A centering technique that puts the content in the center via equal padding around all its sides. See the full article for many more details about this technique and when it's efficient. Full article · Video on YouTube · Source on Github
- CSS
- HTML
2025年2月27日
Line up
The main point demonstrated here is the use of justify-content: space-between, which places the first and last child elements at the edges of their bounding box, with the remaining space evenly distributed between the elements. For these cards, they
- HTML
- CSS
2025年2月27日
Super centered
Use place-items: center to center an element within its parent. This enables the content to be perfectly centered within the parent, regardless of intrinsic size.
- CSS
- HTML
2025年2月27日
Sidebar says
This demo takes advantage of the minmax() function for grid layouts. In the demo this function is used to set the minimum sidebar size to 100px, but on larger screens, letting that stretch out to 25%. The sidebar will always take up 25% of its
- CSS
- HTML
2025年2月27日
Pop n' Plop
A centering technique for overlaying other content. See the full article for many more details about this technique and when it's efficient. Full article · Video on YouTube · Source on Github
- HTML
- CSS
2025年2月27日
Content Center
A centering technique that is only a few lines of CSS, works great for many elements, but has the side effect of making children match the width of the widest element. See the full article for many more details about this technique and when it's
- CSS
- HTML
2025年2月27日
12-span grid
Another classic: the 12-span grid. You can quickly write grids in CSS with the repeat() function. Using: repeat(12, 1fr); for the grid template columns gives you 12 columns each of 1fr. Now you have a 12 column track grid, you can place child
- HTML
- CSS
2025年2月27日