Introduction To CSS
Introduction To CSS
Introduction to CSS
</>
Topics Covered
What is CS
Brief History of CS
CSS versio
Anatomy Structure of CS
Comments in CSS
What is CSS
CSS, which stands for Cascading Style Sheets, is the language used to style an HTML file and tell the browser
how it should render the elements on the page.
Style sheet - A set of rules that specify the presentation of a document. Style sheets are written by an Author,
and interpreted by User Agent, to present the document to the User.
Source document - The document to which one or more style sheets apply. A source document’s structure
and semantics are encoded using a document language(e.g, HTML, XHTML, or SVG)
Author - An author is a person who writes documents and associated style sheets, An authoring tool is a User
Agent that generates style sheets.
User - A user is a person who interacts with a user agent to view, hear or otherwise use the document.
User Agent (UA) - The User-agent basically refers to a browser. User-agent applies default styles as provided
by the browser vendor.
CSS lets us move everything presentation-related from the HTML to the CSS so that HTML could get back to
being the format that defines the structure of the document, rather than how things should look in the
browser.
CSS is continuously evolving, and CSS you used 5 years ago might just be outdated, as new CSS techniques
emerged and browsers changed. It’s hard to imagine the times when CSS was born and how different the
web was. At the time, there were several competing browsers, mainly Internet Explorer or Netscape Navigator.
Pages were styled by using HTML, with special presentational tags like `bold` and special attributes, most of
which are now deprecated. This meant you had a limited amount of customization opportunities. The bulk of
the styling decisions were left to the browser. Also, you built a site for one of them, because each one
introduced different non-standard tags to give more power and opportunities.
CSS version
Cascading Style Sheets is a fairly old technology as far as the Web is concerned. CSS has evolved over time
through different versions, with each version introducing new features, improvements, and capabilities for
web designers and developers.
CSS 1
Classic CSS implementation that introduced the text, list, box, margin, border, colour, and background
properties. Initially defined in 1996, almost every feature of CSS1 is supported in Web browsers, but small
quirks do exist around some lesser-used features like `white space`, `letter-spacing`, `display`, and others.
Some problems with CSS1 support are more significant in older, pre-internet Explorer 7 browsers.
CSS 2
The specification is primarily known for positioning and media, particularly print-style sheet features. Many
aspects of CSS2, such as aural style sheets, were never widely implemented and were removed in a later
iteration of the CSS specification
CSS 2.1
This was a revision of CSS2 and was released in 2004. It clarified and improved the CSS2 specification, fixing
inconsistencies and adding new features, but it did not introduce any major changes.
CSS3
This version of CSS is not a single release but rather a collection of modules that are developed and
released independently. CSS3 introduces a wide range of new features and capabilities, including
advanced selectors, gradients, shadows, animations, transitions, and more. Some of the modules in CSS3
include Selectors, Box Model, Backgrounds and Borders, Text Effects, and Transforms.
CSS selectors define the pattern to select elements to which a set of CSS rules are then applied. CSS
selectors can be grouped into the following categories based on the type of elements they can select. The
categories can be Basic selectors, Group selectors, Combinators, Pseudo-classes, and pseudo-elements.
Properties -
A property is a CSS attribute that defines the aspect of an HTML element to be styled. It could be the font
size, colour, margin, padding, or background
Value -
value is the setting for a CSS property. It can be a specific color, size, or other values that determine the
appearance of the element
Declaration -
A declaration is a combination of a property and its corresponding value. It defines a specific style for an
HTML element
Rule -
A CSS rule consists of a selector and its associated declaration block. It defines the styles to be applied to
the selected element(s).
Comments in CSS
CSS gives you the ability to write comments in a CSS file or in the style sheets. Style sheets use the comment
syntax used in C programming language i.e ` /* comments */ `