Nirajan Basnet
Front-end Engineer, YIPL
Patience
Responsbilties
Creative
Background
.main-content {
background-color: #aeaeae;
background-image: url(images/bg.png);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: top left;
}
.main-content {
background: #aeaeae url(images/bg.png) no-repeat 0 0;
}
Font
.main-content {
font-family: Verdana, Arial, Helvetica;
font-size: 16px;
font-weight: bold;
font-style: italic;
font-variant: normal;
line-height: 1.2;
}
.main-content {
font:italic bold 16px/1.2 Verdana, Arial, Helvetica;
}
Margin & Padding
.main-content {
margin-top: 0;
margin-right: 5px;
margin-bottom: 10px;
margin-left: 15px;
}
.main-content {
margin: 0 5px 10px 15px;
}
.main-content {
margin: 0 auto; (top/bottom right/left)
}
.main-content {
margin: 10px 20px 15px; (top right/left bottom)
}
Border
.main-content {
border-width: 2px;
border-style: dotted;
border-color: red;
}
.main-content {
border: 2px dotted red;
}
.main-content {
border-right: 2px solid #666;
}
.main-content {
border-width: 3px 2px; (top/bottom right/left)
}
Basic syntax - swap
@font-face {
font-family: "Open Sans Regular";
font-weight: 400;
font-style: normal;
src: url("fonts/OpenSans-Regular-BasicLatin.woff2") format("woff2");
font-display: swap;
}
p {
font-family: "Open Sans Regular", "Helvetica", "Arial", sans-serif;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
:empty
:target (Modal)
:hover (Tooltip)
:lang
:valid, :invalid (Form input)
:in-range
:fullscreen
:placeholder-shown
table
absolute,transform
flex
Photo source: Responsive design
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
}
/* Small Devices, Tablets */
@media only screen and (min-width : 768px) {
}
/* Medium Devices, Desktops */
@media only screen and (min-width : 992px) {
}
/* Large Devices, Wide Screens */
@media only screen and (min-width : 1200px) {
}
/*========== Non-Mobile First Method ==========*/
/* Large Devices, Wide Screens */
@media only screen and (max-width : 1200px) {
}
/* Medium Devices, Desktops */
@media only screen and (max-width : 992px) {
}
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
}
/* Extra Small Devices, Phones */
@media only screen and (max-width : 480px) {
}
/* Custom, iPhone Retina */
@media only screen and (max-width : 320px) {
}
Photo source: Flexbox grid
#display
.container {
display: flex | inline-flex;
}
#flex-wrap
.container {
flex-wrap: wrap | no-wrap | wrap-reverse;
}
#justify-content
.container {
justify-content: flex-end | flex-start | center | space-around | space-between;
}
#align-items
.container {
align-items: stretch | flex-start | flex-end | center | baseline;
}
Basic syntax
.main-container {
width: 90%; /* fallback if needed */
width: calc(100% - 3em);
}
.sidebar {
float: left;
width: 200px;
}
.main-content {
float: left;
width: calc(100% - 200px);
}
#element1, #element2 {
float: left;
width: calc(50% - 30px);
}
#element2 {
margin-left: 60px;
}
#element1, #element2 {
width: calc(50% - 2em);
}
#element1, #element2 {
width: calc(50% - 2em - 4px);
border: 2px solid #000;
}
#myelement {
width: max(300px, 30%, 30em);
font-size: min(10px, 0.6em);
}
#element {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
#element {
transition: [transition-property] [transition-duration]
[transition-timing-function] [transition-delay];
}
#element {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
#element {
transition: [transition-property] [transition-duration]
[transition-timing-function] [transition-delay];
}