Easy To Learning
  • Login
  • Sign Up
  • Q&A
  • Home
  • Php Tutorial
  • MySql Tutorial
  • Object-Oriented Programming
  • Java Tutorial
  • HTML Tutorial
  • React JS Tutorials
  • Free Projects
  • Blogs & Articles
  • Others
    • About Us
    • Contact Us
HTML Style
Easy To Learning

Education Needs Complete Solution

Online Ask Question Question And Answer
  1. Home
  2. HTML Tutorials
  3. HTML Style

HTML Tutorial

Basic HTML Fundamentals

  • HTML Table Content
  • Introduction To HTML
  • What Is HTML
  • HTML Tags
  • HTML Formatting
  • HTML Heading
  • HTML Paragraph
  • HTML Anchor
  • HTML Image
  • HTML Table
  • HTML Lists
  • HTML Ordered List
  • HTML Unordered List
  • HTML Description List
  • HTML Form

HTML Tags

  • Marquee HTML
  • HTML Textarea
  • HTML Quotes
  • HTML Style
  • HTML Title Or HTML Doctype
  • HTML Div Tag
  • HTML Pre Tag
  • HTML Code Tag
  • HTML Label Tag
  • HTML Input Tag
  • HTML Button Tag
  • HTML Hr Tag
  • HTML Br Tag
  • HTML Script Tag
  • HTML NoScript Tag
  • HTML Bold Tag

HTML Style

HTML Style

HTML Style is used to change or add the style on existing HTML elements. There is a default style for every HTML element e.g. background color is white, text color is black etc.

The style attribute can by used with any HTML tag. To apply style on HTML tag, you should have the basic knowledge of css properties e.g. color, background-color, text-align, font-family, font-size etc.

HTML Style Syntax

style= "property:value" 

HTML Style color

The color property is used to define the text color.

Simple example of styling html tags by color property of css.

<h2 style="color:blue">This is Blue Color</h2> 
<h3 style="color:red">This is Red Color</h3> 

Output:

This is Blue Color

This is Red Color

HTML Style background-color

The background-color property is used to define background color for the HTML tag.

Example of styling html tag by of css background-color property

<h3 style="background-color:yellow;">This is yellow background</h3> 
<h3 style="background-color:black;color:white">This is Black background</h3> 

Output:

This is yellow background

This is Black background

HTML Style font-family

The font-family property specifies the font family of the HTML tag.

Example of styling html tag by css font-family property

<h3 style="font-family:cursive">This is cursive font family</h3> 
<p style="font-family:arial">This is arial font family</p> 

Output:

This is cursive font family

This is arial font family

HTML Style font-size

The font-size property is used to define the text size of the HTML tag.

Example of font-size property

<h3 style="font-size:100%">This is 100% h3 tag</h3> 
<p style="font-size:100%">This is 100% p tag</p> 

Output:

This is 100% h3 tag

This is 100% p tag

HTML Style text-align

The text-align property is used to define the horizontal text alignment for the HTML element.

Example of styling html tag by css text-align property

<h3 style="text-align:right;background-color:red;">This text is located at right side</h3> 
<p style="text-align:center;background-color:yellow;">This text is located at center side</p> 

If you want to put heading at center or left, use "text-align:center" or "text-align:left" respectively.

Output:

This text is located at right side

This text is located at center side

Supporting Browsers

Element  Chrome  IE  Firefox  Opera  Safari
style attribute Yes Yes Yes Yes Yes
Series: HTML Tutorials Hub
All Topics
Free Download Projects
Previous Chapter
Next Chapter

Ask a Question

Have a coding query or doubt? Ask here and get help from our community.

500 characters remaining
Submitting...
Free Download Projects
Join Telegram Group Join WhatsApp Group
Related Topics:
html style attribute html style tag html inline style text color html html font family style font color font size html how to change font style in html

Member Sign In

Forgot?
Signing in...

Don't have an account? Register here

Create Free Account

Register Captcha
Registering...

Already have an account? Sign In

Ask a Question

500 characters remaining
Submitting...

About Easy To Learning

Easy To Learning is a comprehensive programming learning portal offering free, practical, developer-driven tutorials for PHP, Java, Python, Spring, MySQL, CSS, Bootstrap, CakePHP, and more.

Explore community-contributed questions and answers, and download ready-to-run source code projects.

Quick Links

  • Home
  • Questions & Answers
  • Download Projects
  • Blog & Articles
  • Member Login

Community

  • Telegram Group
  • WhatsApp Community
  • Ask a Question
  • Join as Member

Connect With Us

Stay updated with our newest programming tutorials and free open source projects.

© 2026 Easy To Learning. All Rights Reserved.