Alignment

Can use the text-align property to align content within an element to the center.

<p style="text-align: center">This text is centered.</p>
<div style="text-align: right"> <p> This text is right-aligned. </p> </div>

Can align an element itself to the center using margin (note that width must also be set):

<div style="margin: 0 auto; width: 100px"> 
	<p> This text is aligned normally, but the div itself is centered. </p> 
</div>

Colors

Can define a color with rgb(0, 255, 0), or with the hex code #00ff00. The pairs of hexadecimal digits each denote a number between 0 and 255.

When you specify a color with #fff, each digit is doubled up, so #fff becomes #ffffff and #123 becomes #112233.

Color and Background Color

The color property refers to the color of content inside the element (usually text), the background-color property refers to the color of the element itself. background is a shorthand property that combines many properties (background color, background image) into one.

Self-closing tags

Self-closing tags can be written in either of the following ways. The /> used to be necessary, but now both /> and > work.

<img src="<https://google.com/image1>" />
<img src="<https://google.com/image2>" >

Three Ways to do CSS

Inline CSS:

<p style="color: steelblue"> Hello world </p>

Internal CSS:

<head>
	<style>
		p { 
				color: steelblue;
		}
	</style>
</head>
<body>
	<p> Hello world </p>
</body>

External CSS (the type=text/css is no longer necessary):

<head>
	<link href="css/styles.css" rel="stylesheet">
</head>