How to draw shapes with CSS3

Today is weekend but all my friends are busy. It sounds boring, so I sit here to write some tricks about drawing shapes with css3. All of below use only HTML element, and may be IE below version 10 is not display correctly.

Square

#square {
	width: 100px;
	height: 100px;
	background: red;
}

Rectangle

#rectangle {
	width: 200px;
	height: 100px;
	background: red;
}

Circle

#circle {
	width: 100px;
	height: 100px;
	background: red;
	-moz-border-radius: 50px;
	-webkit-border-radius: 50px;
	border-radius: 50px;
}

/* You can use 50% as value */

Oval

#oval {
	width: 200px;
	height: 100px;
	background: red;
	-moz-border-radius: 100px / 50px;
	-webkit-border-radius: 100px / 50px;
	border-radius: 100px / 50px;
}

/* Cleaner, but slightly less support: use "50%" as value */
					
}

Triangle Down

#triangle-down {
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-top: 100px solid red;
}
					

Triangle Left

#triangle-left {
	width: 0;
	height: 0;
	border-top: 50px solid transparent;
	border-right: 100px solid red;
	border-bottom: 50px solid transparent;
}
					

Triangle Right

#triangle-right {
	width: 0;
	height: 0;
	border-top: 50px solid transparent;
	border-left: 100px solid red;
	border-bottom: 50px solid transparent;
}
					

Triangle Top Left

#triangle-topleft {
	width: 0;
	height: 0;
	border-top: 100px solid red;
	border-right: 100px solid transparent;
}
					

Triangle Top Right

#triangle-topright {
	width: 0;
	height: 0;
	border-top: 100px solid red;
	border-left: 100px solid transparent;

}
				

Triangle Bottom Left

#triangle-bottomleft {
	width: 0;
	height: 0;
	border-bottom: 100px solid red;
	border-right: 100px solid transparent;
}
					

Triangle Bottom Right

#triangle-bottomright {
	width: 0;
	height: 0;
	border-bottom: 100px solid red;
	border-left: 100px solid transparent;
}
					
I'm 26 years old, a web developer from Nha Trang, Viet Nam. I love travelling and listen to rock music all day. This site is where I share my knowledges, my moments and some stuff...Wanna drink some beer? Feel free to contact me at the footer.