[CSS] max-content, min-content, fit-content

max-content

https://developer.mozilla.org/en-US/docs/Web/CSS/max-content

The max-content sizing keyword represents the maximum intrinsic size of the content. For text content this means that the content will not wrap at all even if it causes overflows.

 

min-content

https://developer.mozilla.org/en-US/docs/Web/CSS/min-content

The min-content sizing keyword represents the minimum intrinsic size of the content. For text content this means that the content will take all soft-wrapping opportunities, becoming as small as the longest word.

 

fit-content

https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content

The fit-content keyword is equivalent to fit-content(stretch). In practice, this means that the box will use the available space, but never more than max-content.

width: fit-content;

// the same as 

min-width: min-content;
width: auto;
max-width: max-content;

 

fint-content(strach)

https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content_function

The fit-content() CSS function clamps a given size to an available size according to the formula min(maximum size, max(minimum size, argument)).

 

minmax()

https://developer.mozilla.org/en-US/docs/Web/CSS/minmax

The minmax() CSS function defines a size range greater than or equal to min and less than or equal to max. It is used with CSS grids.

 

clamp()

https://developer.mozilla.org/en-US/docs/Web/CSS/clamp

The clamp() CSS function clamps a middle value within a range of values between a defined minimum bound and a maximum bound. The function takes three parameters: a minimum value, a preferred value, and a maximum allowed value.

font-size: clamp(1rem, 2.5vw, 2rem); 

 

posted @   Zhentiw  阅读(8)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2021-08-02 [SAA + SAP] 16. RDS
2021-08-02 [SAA + SAP] 15. ElastiCache
2021-08-02 [SAA + SAP] 14. CloudFront & AWS Global Accelerator
2018-08-02 [Vue @Component] Extend Vue Components in TypeScript
2017-08-02 [React] Style the body element with styled-components and "injectGlobal"
2017-08-02 [React] Style a React component with styled-components
2017-08-02 [D3] Create DOM Elements with D3 v4
点击右上角即可分享
微信分享提示