HTML Styles
HTML Styles
HTML styles are used to change the appearance of HTML elements. Styles are added using the style attribute, which uses CSS (Cascading Style Sheets).
Syntax of HTML Style
Example
Common HTML Style Properties
1. Text Color
2. Background Color
3. Font Size
4. Font Family
5. Text Alignment
6. Text Decoration
7. Font Weight (Boldness)
Multiple Styles in One Element
Styles on Headings
Using Styles vs CSS (Best Practice)
❌ Inline style (not recommended for large projects):
✅ Better approach (using CSS):
Important Points to Remember
-
styles are written using CSS properties
-
Inline styles are good for small examples
-
For real websites, use external CSS
-
HTML itself does not control design, CSS does
