Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
44
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
98
Hexo.js & Github Pages
ricardogouveia3
1
99
Diagrama de Portas (Doors Diagram)
ricardogouveia3
1
41
Other Decks in Programming
See All in Programming
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
160
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
670
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
250
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
920
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
250
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
250
ONE WEDGE_company_guide
1wedge_one
0
440
今、知っておきたい! 生成AIエージェントの世界
elith
3
350
What We Can Learn From OSS
inouehi
0
420
try! Swift Tokyo 初参加報告LT
hinakko2
0
210
ゆるい個人開発のススメ
kuroppe1819
10
980
入門 AWS Amplify Gen2 / Introduction to AWS Amplify Gen2
genkiogasawara
1
320
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
15
2.1k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
How STYLIGHT went responsive
nonsquared
92
4.8k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Designing for Performance
lara
601
67k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Automating Front-end Workflow
addyosmani
1355
200k
The Cost Of JavaScript in 2023
addyosmani
15
3.8k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Making the Leap to Tech Lead
cromwellryan
123
8.5k
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