HVPM College of Engineering & Technology
Department of Computer Science & Engineering
C Skill Lab 2
Program No. 3
Aim: Introduction to CSS- Cascading Style Sheets & working with CSS commands
Theory:- CSS stands for Cascading Style Sheets.
CSS describes how HTML elements should be displayed on screen, paper, or in other
media.
CSS saves a lot of work. It can control the layout of multiple web pages all at once.
External stylesheets are stored in CSS files.
CSS is the language we use to style an HTML document.
CSS describes how HTML elements should be displayed.
CSS Syntax:-
A CSS rule consists of a selector and a declaration block:
The selector points to the HTML element to style (h1).
The declaration block (in curly braces) contains one or more declarations separated by
semicolons.
Each declaration includes a CSS property name and a value, separated by a colon.
Example:- save as mystyle.css
<style>
body {background-color: orange; font-family:verdana}
h1 {color: blue; font-size:12px}
p {font-size:32px; color:red; text-align:center;}
</style>
Linking CSS file with HTML:-
<html>
<link rel="stylesheet" href="mystyle.css">
<body>
<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>
</body>
</html>
Example:- Give 1 more Example using at least 5 styling tags & paste output screenshot.
Results:- Thus we have Studied Cascading Style Sheets (CSS) & used various CSS commands.