惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
K
Kaspersky official blog
雷峰网
雷峰网
Latest news
Latest news
Know Your Adversary
Know Your Adversary
Martin Fowler
Martin Fowler
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
O
OpenAI News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
V
V2EX
F
Full Disclosure
Cyberwarzone
Cyberwarzone
G
Google Developers Blog
A
Arctic Wolf
Hacker News - Newest:
Hacker News - Newest: "LLM"
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
B
Blog RSS Feed
H
Hacker News: Front Page
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
P
Palo Alto Networks Blog
PCI Perspectives
PCI Perspectives
NISL@THU
NISL@THU
Engineering at Meta
Engineering at Meta
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园_首页
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
Simon Willison's Weblog
Simon Willison's Weblog
T
Troy Hunt's Blog
S
Securelist
S
Security Affairs
A
About on SuperTechFans
F
Fortinet All Blogs

Defensive CSS

Defensive CSS - Button minimum width Defensive CSS - Input zoom on iOS Safari Defensive CSS - Default flexbox stretching Defensive CSS - Image inner border Defensive CSS - Accidental hover on mobile Defensive CSS - Vertical media queries Defensive CSS - Text over image Defensive CSS - Using space-between Defensive CSS - Scrollbars on demand Defensive CSS - Scrollbar gutter Defensive CSS - Scroll chaining Defensive CSS - Position sticky with CSS Grid Defensive CSS - Image maximum width Defensive CSS - Grouping vendor selectors Defensive CSS - Minimum Content Size In CSS grid Defensive CSS - Fixed sizes Defensive CSS - CSS Variable Fallback Defensive CSS - CSS grid fixed values Defensive CSS - Background repeat Defensive CSS - Auto-fit Vs Auto-fill Defensive CSS - Component Spacing Defensive CSS - Long Content Defensive CSS - Image Distortion Defensive CSS - Flexbox Wrapping
Defensive CSS - Minimum Content Size In CSS Flexbox
2022-04-20 · via Defensive CSS

If a flex item has a text element or an image that is bigger than the item itself, the browser won’t shrink them. That is the default behavior for flexbox.

Consider the following example.

Even if we use overflow-wrap: break-word, it won’t work.

To change that default behavior, we need to set the min-width of the flex item to 0. That’s because the min-width default value is auto, the overflow happens.

The same thing applies to a column flex wrapper, but we will use min-height: 0 instead.

In this example, the card title is too long. As a result, flexbox will apply the default behaviour which is to make the element size as equal to its content length.

That's because the default min-width value is auto.

This is a sampletitlethatisabiglong

Toggle Defensive

To fix that, we need to apply min-width: 0 on the flex item. Try to check the "Toggle defensive" checkbox to see it yourself.