Skip to content

Instantly share code, notes, and snippets.

@terrychan999
Last active April 26, 2021 14:38
Show Gist options
  • Save terrychan999/ab363f00ce7f3f2a7ec03d95d7df2ad4 to your computer and use it in GitHub Desktop.
Save terrychan999/ab363f00ce7f3f2a7ec03d95d7df2ad4 to your computer and use it in GitHub Desktop.
CSS font size using relative unit
html {
font-size: 16px;
}
html * {
font-size: 1rem;
}
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.5rem;
}
h3 {
font-size: 1.17rem;
}
h4 {
font-size: 1rem;
}
h5 {
font-size: .83rem;
}
h6 {
font-size: .67rem;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
}
/*for screen size like iPhone5*/
@media only screen and (max-width: 350px) {
html {
font-size: 14px;
}
}
/*涵蓋大部分系統之中文黑體*/
html,
body {
font-family: 'Noto Sans CJK TC', 'PingFang', 'Microsoft JhengHei', sans-serif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment