Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Unidades Mágicas do CSS3
Search
Ricardo Gouveia
February 27, 2016
Programming
0
54
Unidades Mágicas do CSS3
Apresentação de algumas unidades que, apesar de muito úteis, são pouco conhecidas.
Ricardo Gouveia
February 27, 2016
Tweet
Share
More Decks by Ricardo Gouveia
See All by Ricardo Gouveia
Performance Pré JS
ricardogouveia3
2
110
Hexo.js & Github Pages
ricardogouveia3
1
110
Diagrama de Portas (Doors Diagram)
ricardogouveia3
1
49
Other Decks in Programming
See All in Programming
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.5k
STYLE
koic
0
170
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
500
connect-python: convenient protobuf RPC for Python
anuraaga
0
400
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
230
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
120
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
320
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
Cap'n Webについて
yusukebe
0
130
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
Featured
See All Featured
KATA
mclloyd
PRO
32
15k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Done Done
chrislema
186
16k
Docker and Python
trallard
47
3.7k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
How STYLIGHT went responsive
nonsquared
100
6k
RailsConf 2023
tenderlove
30
1.3k
Agile that works and the tools we love
rasmusluckow
331
21k
GraphQLとの向き合い方2022年版
quramy
50
14k
Transcript
Unidades Mágicas do CSS3 rem, vh, vw, vmin, vmax, ex,
ch
Ricardo Gouveia Q @ricardogouveia3 a
rem “root em” Tamanho relativo ao elemento-raiz (em geral <html>)
“em” <html style=“font-size: 10px;”> <body style=“font-size: 15px;”> <h1 style=“font-size: 2em;”>TEXT</h1>
</body> </html> TEXT font-size: 2 * 15px = 30px
“rem” <html style=“font-size: 10px;”> <body style=“font-size: 15px;”> <h1 style=“font-size: 2rem;”>TEXT</h1>
</body> </html> TEXT font-size: 2 * 10px = 20px
vh “viewport height” Tamanho relativo a altura da janela (exceto
quando modificado via meta viewport)
“vh” <div style=“height: 100vh;”></div> 1080px 1920px div
vw “viewport width” Tamanho relativo a largura da janela (exceto
quando modificado via meta viewport)
“vw” <div style=“width: 100vw;”></div> 1080px 1920px div
vmin “viewport min value” Relativo ao menor valor entre altura
e largura
<div style=“height: 100vmin;”></div> 600px 1920px “vmin” div 600px 1300px div
height 600px
se (height < width) { 100vmin = height; } senão
{ 100vmin = width; } “vmin”
vmax “viewport max value” Relativo ao maior valor entre altura
e largura
“vmax” <div style=“height: 100vmax;”></div> 600px 1920px div 600px 1920px div
height 1920px
“vmax” se (height > width) { 100vmax = height; }
senão { 100vmax = width; }
“uso de vmin e vmax” Quando um elemento precisa ser
sempre visível ou cobrir toda a tela 600px 1920px div 600px 1300px div height: 100vmin; width: 100vmin; height: 100vmax; width: 100vmax;
ex “font height-x” para programadores: Altura do caractere “x” ou
1/2em da fonte atual para designers: altura da fonte, excluindo ascendentes e descendentes altura x = distância entre linha de base e linha x
Altura-x “ex” } 1ex
ch “character unit” Tamanho relativo a largura do caractere “0”
na fonte atual (levando em conta font-family + font-size)
“ch” <div style=“width: 10ch; font-family: monospace;”></div> 0123456789 div 10 char
None