Introduction to CSS



What is CSS?


It stands for Cascading Style Sheets. It is use for applying the styles for the HTML elements, which use to describe the look and formatting of a document written in markup language. It can also be use with kind of XML documents including plain XML and SVG. CSS is designed to separate the presentation and content, including layout and colors, and fonts. This separation can improve content accessibility provide more flexibility and control in the specification of presentation characteristics.

CSS can be written inline within HTML elements, embedded within the <style> tags in the <head> section of an HTML document, or stored in external CSS files that can be linked to multiple HTML documents, allowing for easier maintenance and consistency across a website.

The syntax of CSS follows a specific structure and format. The common components are:

Selectors:- Selectors target HTML elements to which styles will be applied. They can be based on element types, class names, IDs, attributes, or relationships with other elements. Selectors are followed by curly braces {}.

Example of selectors:-

Element type selector-  p targets all <p> elements.
Class selector-  .classname targets elements with a specific class name.
ID selector-  #elementID targets an element with a specific ID.
Declarations: Declarations define the styles to be applied to the selected elements. They consist of a property and a value, separated by a colon (:). Multiple declarations are separated by semicolons (;).

Post a Comment

0 Comments