Adding CSS to HTML 3 Approaches (original) (raw)
Last Updated : 11 May, 2026
Each method serves a different purpose based on how you organize and manage your styles.
- Helps you structure CSS according to your project needs.
- Makes your code easier to maintain and update.
- Allows flexibility in applying styles to different parts of a webpage.
- Improves readability and reusability of your design.
1. Inline CSS
Inline CSS allows you to apply styles directly within HTML tags using the style attribute. This method is useful for small-scale styling or when you need to apply a unique style to a single element.
HTML `
Inline CSS<h2 style="color: green;">
Welcome to
<i style="color: green;">
GeeksforGeeks
</i>
</h2>
`
2. Internal CSS
Internal CSS involves adding CSS styles directly within the HTML file by including them inside the