Lỗi layout CSS thường không phải do Flexbox hay Grid! Hầu hết chúng đến từ các vấn đề về đơn vị như 100vh trên mobile, em bị nhân đôi, hoặc px bỏ qua tỷ lệ chữ. Hiểu rõ về các đơn vị CSS có thể giúp bạn tránh nhiều phiền toái!

#CSS #Layout #WebDevelopment #Frontend #Programming #BugFixing
#LỗiCSS #PhátTriểnWeb #FrontendDev #LậpTrình #CSSUnits

https://www.reddit.com/r/programming/comments/1q8n7vg/most_css_layout_bugs_are_unit_bugs/

#Development #Techniques
Simple full-bleed and breakout styles · Modern CSS solutions for a classic problem https://ilo.im/1682wb

_____
#ModernCSS #CssGrid #CssUnits #FullBleed #Layout #WebDev #Frontend #HTML #CSS

Super Simple Full-Bleed & Breakout Styles – Frontend Masters Blog

Having a width-limited centered column of content is common and good, but what do you do when you need to break out? It's not hard these days, but it does depend on the situation.

#Development #Techniques
Transition to the other side · A little CSS magic with container query units https://ilo.im/167m1o

_____
#ModernCSS #CssUnits #CssCalc #Transitions #Animations #WebDev #Frontend #CSS

Transition to the Other Side with Container Query Units

How container queries help move an element to the opposite side of its parent container when both have dynamic responsive dimensions.

#Development #Approaches
The best CSS unit for spacing · “We don’t have to choose between px and rem.” https://ilo.im/1673zo

_____
#CssUnits #CssClamp #CssCalc #CustomProperties #WebDev #Browser #Frontend #CSS

The Best CSS Unit Might Be a Combination

We don't have to choose between px and rem for spacing

OddBird

#Development #Techniques
Designing for user font-size and zoom · Using modern CSS units and math functions https://ilo.im/165luy

_____
#ModernCSS #Typography #FluidType #Fonts #Zoom #Browser #WebDev #Frontend #CSS #CssUnits

Designing for User Font-size and Zoom

Using modern CSS units and math functions

OddBird

#Development #Techniques
The CSS height enigma · Unraveling the mystery of percentage-based heights https://ilo.im/163u5k

_____
#Layout #CssUnits #CssGrid #CssFlexbox #WebDev #Frontend #HTML #CSS

The Height Enigma • Josh W. Comeau

One of the most perplexing and befuddling things in CSS for me, for many years, was the behaviour of percentage-based heights. Sometimes, seemingly at random, setting height: 100% would have no effect at all. When I finally figured out what was going on, it was like a puzzle piece snapping into place; everything made so much more sense! In this post, I’ll share the epiphany I had, and we’ll explore some solutions.

The CSS shape() function

Shapes are an important aspect of graphic design.

WebKit

#Development #Techniques
Full-bleed layout with modern CSS · Edge-to-edge sections with minimal code https://ilo.im/1621v3

_____
#ModernCSS #Layout #WebDev #Frontend #CSS #CustomProperties #CssUnits #CssCalc

Full-Bleed Layout with Modern CSS – Frontend Masters Boost

Just four declarations in CSS can handle this nicely, while avoiding the vertical scrollbar issue.

#Development #Previews
New values and functions in CSS · Long-desired features are making it into the specs https://ilo.im/1605ka

_____
#ModernCSS #CssFunctions #CssUnits #Specification #Browser #WebDev #Frontend #CSS

New Values and Functions in CSS

The CSS Working Group released the first Public Working Draft for the CSS Values and Units Module Level 5. It describes the common values and units that CSS properties accept and the syntax used for them, and it comes with some interesting new features. A review of some new functions and values that you will see in CSS (hopefully soon) :: Blog post at Alvaro Montoro's Personal Website.

If you want a fixed aspect-ratio element that always touches either the horizontal or vertical edges of its flexible size and aspect ratio wrapper *which does not coincide with the viewport*, you can make the wrapper a container and use container query units.

Live test on @codepen https://codepen.io/thebabydino/pen/ExzbVmP

#CSS #cssLayout #layout #container #containerQueries #containerQuery #cssUnits #code #coding #frontend #web #dev #webDev

aspect-ratio boxes with container queries

...