Cheatsheet for CSS3

a. aligning an object in center of another div :

margin-left: auto;
margin-right: auto;

b. positioning a div anywhere on the screen. top doesn’t work without position being set as absolute.

position: absolute;
left: 94px;
top: 154px;

c. rotating a image

transform: rotate(-180deg);
-ms-transform: rotate(-180deg); /* IE 9 */
-webkit-transform: rotate(-180deg); /* Safari and Chrome */
display: none\9; /* hide this from ie 7 or 8 */

d. arranging two divs in the same line. To make this happen you need to make use of the float and width properties.

.left {
float: left;
width:50%
}
.right {
float:right;
width:50%
}

Leave a Reply

Your email address will not be published. Required fields are marked *