Skip to content

Instantly share code, notes, and snippets.

@eugenioclrc
Forked from jyio/ionic-rem.css
Created November 28, 2014 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugenioclrc/210e92ed3475171b9c07 to your computer and use it in GitHub Desktop.
Save eugenioclrc/210e92ed3475171b9c07 to your computer and use it in GitHub Desktop.
/*
ionic-rem.css
based on ionic 1.0.0-beta.11
makes it easy to scale all the things, e.g.
html {
font-size: 150%;
}
*/
.h1, .h2, .h3, h1, h2, h3 {
margin-top: 1.25rem; /* 20px */
margin-bottom: 0.625rem; /* 10px */
}
.h4, .h5, .h6, h4, h5, h6 {
margin-top: 0.625rem; /* 10px */
margin-bottom: 0.625rem; /* 10px */
}
.h1, h1 {
font-size: 2.25rem; /* 36px */
}
.h2, h2 {
font-size: 1.875rem; /* 30px */
}
.h3, h3 {
font-size: 1.5rem; /* 24px */
}
.h4, h4 {
font-size: 1.125rem; /* 18px */
}
.h5, h5 {
font-size: 0.875rem; /* 14px */
}
.h6, h6 {
font-size: 0.75rem; /* 12px */
}
p {
margin: 0 0 0.625rem;
}
.item {
padding: 1rem; /* 16px */
font-size: 1rem; /* 16px */
}
.item-divider {
padding-top: 0.5rem; /* 8px */
padding-bottom: 0.5rem; /* 8px */
}
.item h2 {
font-size: 1rem; /* 16px */
margin: 0 0 0.25rem; /* 4px */
}
.item h3 {
font-size: 0.875rem; /* 14px */
margin: 0 0 0.25rem; /* 4px */
}
.item h4 {
font-size: 0.75rem; /* 12px */
margin: 0 0 0.25rem; /* 4px */
}
.item h5, .item h6 {
font-size: 0.625rem; /* 10px */
margin: 0 0 0.1875rem; /* 3px */
}
.item p {
font-size: 0.875rem; /* 14px */
}
.bar {
padding: 0.3125rem; /* 5px */
height: 2.75rem; /* 44px */
}
.bar .title {
margin: 0 0.625rem; /* 10px */
min-width: 1.875rem; /* 30px */
height: 2.6875rem; /* 43px */
font-size: 1.0625rem; /* 17px */
line-height: 2.75rem; /* 44px */
}
.bar-subheader{
top: 2.75rem; /* 44px */
}
.button:after {
top: -0.375rem; /* -6px */
right: -0.375rem; /* -6px */
bottom: -0.375rem; /* -6px */
left: -0.375rem; /* -6px */
}
.bar .button .icon:before, .bar .button.button-icon:before, .bar .button.icon-left:before, .bar .button.icon-right:before, .bar .button.icon:before {
padding-right: 0.125rem; /* 2px */
padding-left: 0.125rem; /* 2px */
font-size: 1.25rem; /* 20px */
line-height: 2rem; /* 32px */
}
.bar .button.button-icon .icon:before, .bar .button.button-icon.icon-left:before, .bar .button.button-icon.icon-right:before, .bar .button.button-icon:before {
font-size: 2rem; /* 32px */
line-height: 2rem; /* 32px */
}
.bar .button.button-icon {
font-size: 1.0625rem; /* 17px */
}
.bar .button {
padding: 0 0.5rem; /* 8px */
min-height: 1.9375rem; /* 31px */
font-size: 0.8125rem; /* 13px */
line-height: 2rem; /* 32px */
}
.button-icon {
padding: 0 0.375rem; /* 6px */
}
.button {
padding: 0 0.75rem; /* 12px */
min-width: 3.25rem; /* 52px */
min-height: 2.9375rem; /* 47px */
border-radius: 0.125rem; /* 2px */
font-size: 1rem; /* 16px */
line-height: 2.625rem; /* 42px */
}
button, input, label, select, textarea {
font-size: 0.875rem; /* 14px */
}
.ionic-body, body {
font-size: 0.875rem; /* 14px */
line-height: 1.25rem; /* 20px */
}
.has-header {
top: 2.75rem; /* 44px */
}
.has-subheader {
top: 5.5rem; /* 88px */
}
.has-tabs-top {
top: 5.8125rem; /* 93px */
}
.has-header.has-subheader.has-tabs-top {
top: 8.5625rem; /* 137px */
}
.has-footer {
bottom: 2.75rem; /* 44px */
}
.has-subfooter {
bottom: 5.5rem; /* 88px */
}
.has-tabs, .bar-footer.has-tabs {
bottom: 3.0625rem; /* 49px */
}
.has-footer.has-tabs {
bottom: 5.8125rem; /* 93px */
}
.card, .list-inset {
margin: 1.25rem 0.625rem; /* 20px 10px */
border-radius: 0.125rem; /* 2px */
}
.card .item.item-input input, .list-inset .item.item-input input, .padding-horizontal > .list .item.item-input input, .padding > .list .item.item-input input {
padding-right: 2.75rem; /* 44px */
}
.item-icon-left .icon:before, .item-icon-right .icon:before {
width: 2rem; /* 32px */
}
.item-icon-left {
padding-left: 3.375rem; /* 54px */
}
.item-icon-left .icon {
left: 0.6875rem; /* 11px */
}
.item-icon-right {
padding-right: 3.375rem; /* 54px */
}
.item-icon-right .icon {
right: 0.6875rem; /* 11px */
}
.item-icon-left .icon, .item-icon-right .icon {
font-size: 2rem; /* 32px */
}
.placeholder-icon:first-child {
padding-right: 0.375rem; /* 6px */
}
.item-input {
padding: 0.375rem 0 0.3125rem 1rem; /* 6px 0px 5px 16px */
}
.item-input .icon {
min-width: 0.875rem; /* 14px */
}
input[type="color"], input[type="date"], input[type="datetime-local"], input[type="datetime"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"], textarea {
padding-top: 0.125rem; /* 2px */
height: 2.125rem; /* 34px */
font-size: 0.875rem; /* 14px */
line-height: 1rem; /* 16px */
}
.item-input input {
padding-right: 1.5rem; /* 24px */
}
@eugenioclrc
Copy link
Author

cat ionic.css | python -c "import sys,re;[sys.stdout.write(re.sub(r'([\d.]+)\s*px',(lambda m:(str(float(m.group(1))/16)+'rem') if float(m.group(1))>1 else (m.group(1)+'px')),line)) for line in sys.stdin]" > ionic.rem.css

FROM:
http://forum.ionicframework.com/t/scaling-ionic-with-css-rem-units/12416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment