CSS (Cascading Style Sheet) is used to apply styles (ex., font, colors, padding, border, margin) to HTML elements.
Note:
Ex.HTML = Like Car with accessories but without painting and polished (semi furnished).
HTML + CSS = Like Car with accessories, painting and polished (full furnished).
Example : Create simple HTML page without CSS.
<!DOCTYPE html />
<html>
<head>
<title> CSS Introduction </title>
</head>
<body >
<h1> Employee Information </h1>
<div> Full Name: Matt Bill</div>
<div> DOB: 03/02/2000 </div>
<div> City: Los Angeles</div>
<div> State: CA</div>
</body>
</html>
Result:
In the above example,
Example : Create simple HTML page with CSS.
Note: 1) CSS styles can be applied using three different ways (please refer CSS Styles link ).
2) In this example, internal CSS style sheet is applied.
<!DOCTYPE HTML>
<html>
<head>
<title> CSS Introduction </title>
<style>
h1 {
color:white;
background-color:green;
}
div {
font-size:x-large;
padding:10px;
}
</style>
</head>
<body>
<h1> Employee Information </h1>
<div> Full Name: Matt Bill</div>
<div> DOB: 03/02/2000 </div>
<div> City: Los Angeles</div>
<div> State: CA</div>
</body>
</html>
Result:
In the above example,