Syntax

The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.


			<!DOCTYPE html>
			<html>
			<head>
				<title>Demo</title>
				<style type="text/css">
					p{
						color: blue;
						text-align: justify;
					}
				</style>
			</head>
			<body>
				<div>
					<p>Hello World</p>
				</div>
			</body>
			</html>
		

In the internal style sheet, we are using p as the selector, it means we are selecting all the paragraph element in the document. We have defined two style here, one is color and another is text-align. The color of the all paragraph will be bule and the text will be justify aligned. There are various type of selector available in CSS to pick up the actual element to style. There are different rules we will discuss them in another chapter.

So this is the basic syntax and this is all. Yes, This is everything. Now all you have to know the various kind of property and their possible values.

Comment

CSS only supports only one type of comment. it starts with /* and ends with */. It is a multiline comment.


			p {
			    color: red;
			    /* This is a single-line comment */
			    text-align: center;
			}
			/* This is
			a multi-line
			comment */