CSS - Tutorial
CSS - Tutorial
CSS - Tutorial
CSS is the acronym for "Cascading Style Sheet". It's a style sheet language
used for describing the presentation of a document written in a markup language
like HTML. CSS helps the web developers to control the layout and other visual
aspects of the web pages. CSS plays a crucial role in modern web development by
providing the tools necessary to create visually appealing, accessible, and
responsive websites.
CSS Versions
Since the inception of CSS, several versions have came into existence. Some of
the notable versions include:
Each version of CSS builds upon the previous ones, adding new features and
refining existing capabilities to meet the evolving needs of web developers and
designers. CSS is referred as just CSS now, without a version number.
1 of 4 3/17/2024, 2:17 AM
CSS - Tutorial about:blank
Advantages of CSS
Responsive design - CSS offers features like media queries that enable
developers to create responsive layouts that adapt to different screen sizes
and devices, ensuring a consistent user experience.
Prerequisites
Before using CSS extensively, it is essential to have a baisc understanding of the
following prerequisites:
2 of 4 3/17/2024, 2:17 AM
CSS - Tutorial about:blank
If you are new to HTML and XHTML, then we would suggest you to go through our
HTML or XHTML Tutorial first.
Components of CSS
CSS works by associating rules with HTML elements. A CSS rule contains two main
parts:
Each declaration includes a property name and a value, specifying the aspect of
the element's presentation to control.
Sample Code
Just to give you a little excitement about CSS, here is a sample CSS snippet for
your reference.
<html>
<head>
<title>CSS Tutorial</title>
<style>
h1 {
color: #36CFFF;
}
p {
font-size: 1.5em;
color: white;
}
div {
border: 5px inset gold;
background-color: black;
width: 300px;
3 of 4 3/17/2024, 2:17 AM
CSS - Tutorial about:blank
text-align: center;
}
</style>
</head>
<body>
<div>
<h1>Hello World!</h1>
<p>This is a sample CSS code.</p>
</div>
</body>
</html>
h1, p, and div are the selectors that target the <h1>, <p>, and <div>
elements.
#36CFFF, 1.5em, white, 5px inset gold, black, 300px, and center are
the corresponding values passed to these properties.
For a quick glance of CSS properties and features, check our CSS Reference page.
4 of 4 3/17/2024, 2:17 AM