TheBrahminCoder - What is CSS and types of CSS

 CSS stands for Cascading Style Sheets. It is a stylesheet language used to describe the presentation and formatting of a document written in HTML or XML. CSS is used to control the layout, colors, fonts, and other visual aspects of web pages. It separates the structure and content of a webpage from its presentation, allowing for greater flexibility and easier maintenance.


There are three main types of CSS:


1. Inline CSS: 

Inline CSS is applied directly within the HTML elements using the "style" attribute. It has the highest specificity and overrides other CSS rules. Here's an example:


2. Internal CSS: 

Internal CSS is defined within the `<style>` tags in the `<head>` section of an HTML document. It applies to the entire document or specific elements using selectors. Here's an example:


3. External CSS: 

External CSS is stored in a separate file with a `.css` extension and linked to the HTML document using the `<link>` tag. It allows for a centralized and reusable style sheet across multiple web pages. Here's an example:


HTML file (index.html):


CSS file (styles.css):


In the above example, the CSS file (styles.css) contains the CSS rules that will be applied to the HTML elements with the class "blue-text."

These are the three main types of CSS, each offering a different approach to styling web pages.

Comments

Popular posts from this blog

TheBrahminCoder - What is script tag and types of scripts

TheBrahminCoder - What are the most popular library and frameworks of JavaScript for Frontend Development

TheBrahminCoder - What is Server-side rendering (SSR) ,client-side rendering (CSR) and hybrid Rendering