HTML Styles – CSS
HTML Styles – CSS
CSS (Cascading Style Sheets) is used to style and format HTML elements. Instead of adding styles directly inside HTML tags, CSS makes the design cleaner, easier to manage, and more professional.
CSS can be applied in three ways:
1. Inline CSS
CSS is added directly inside an HTML tag using the style attribute.
2. Internal CSS
CSS is written inside the <style> tag in the <head> section.
3. External CSS
CSS is written in a separate .css file and linked using <link> tag.
HTML File:
style.css File:
Output Preview
-
Inline CSS → only affects one specific element
-
Internal CSS → affects multiple elements on the same page
-
External CSS → best for full website styling
Why CSS?
✔ Makes design easier
✔ Reduces repeated code
✔ Improves website appearance and layout
CSS is the standard way to style and design web pages professionally.
