TYPES OF CSS (Cascading Style Sheets)
CSS, or Cascading Style Sheets, is a stylesheet language used for describing the presentation of a document written in HTML or XML. There are several types of CSS that can be used in web development.
1. Inline CSS:
Inline CSS is applied directly to an HTML element using the `style` attribute. It overrides any other CSS rules applied to the element. 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. Here's an example:
3. External CSS:
External CSS is defined in a separate CSS file and linked to an HTML document using the `<link>` tag. It allows the same CSS rules to be applied across multiple HTML documents. Here's an example:
HTML file:
CSS file (styles.css):
4. CSS Selectors:
CSS selectors are used to target specific HTML elements for styling. Here are a few examples of CSS selectors:
- Element Selector:
Targets all instances of a specific HTML element.
For example:
Class Selector:
Targets elements with a specific class attribute with a ( . ) with each selector
For example:
-ID Selector:
Targets a specific element with a unique ID attribute. For example:
if the blog is helpful for you must share and comment..........
THANK YOU💖
0 Comments