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.

CodeCapsule

Sanjit Sinha — Web Developer | PHP • Laravel • CodeIgniter • MySQL • Bootstrap Founder, CodeCapsule — Student projects & practical coding guides. Email: info@codecapsule.in • Website: CodeCapsule.in

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *