Styles
HTML Styles
The HTML style attribute is used
to add styles to an element, such
as color, font, size, and more.
Style Attribute
Syntax:
<tagname style="property:value;">
Background Color
The CSS background-color
property defines the background
color for an HTML element.
<body style="background-color:orange;">
<tagname style="property:value;">
Background color for two different
elements
<h1 style="background-color:cornflowerblue;">Lyceum of Alabang</h1>
<p style="background-color:gold;">School Year 2020-2021</p>
Text Color
The CSS color property defines
the text color for an HTML
element.
<h1 style="color:blue;">Lyceum of Alabang</h1>
<p style="color:green;">School Year 2020-2021</p>
Fonts
The CSS font-family property
defines the font to be used for an
HTML element.
<h1 style="font-family:century gothic;">Lyceum of Alabang</h1>
<p style="font-family:arial;">School Year 2020-2021</p>
Text Size
The CSS font-size property
defines the text size for an HTML
element.
<h1 style="font-size:100px;">Lyceum of Alabang</h1>
<p style="font-size:25px;">School Year 2020-2021</p>
Text Alignment
The CSS text-align property
defines the horizontal text
alignment for an HTML element.
<h1 style="text-align:center;">Lyceum of Alabang</h1>
<p style="text-align:center;">School Year 2020-2021</p>
Using Style Attribute in HTML and its properties

Using Style Attribute in HTML and its properties

  • 1.
  • 2.
    HTML Styles The HTMLstyle attribute is used to add styles to an element, such as color, font, size, and more.
  • 3.
  • 4.
    Background Color The CSSbackground-color property defines the background color for an HTML element. <body style="background-color:orange;"> <tagname style="property:value;">
  • 5.
    Background color fortwo different elements <h1 style="background-color:cornflowerblue;">Lyceum of Alabang</h1> <p style="background-color:gold;">School Year 2020-2021</p>
  • 6.
    Text Color The CSScolor property defines the text color for an HTML element. <h1 style="color:blue;">Lyceum of Alabang</h1> <p style="color:green;">School Year 2020-2021</p>
  • 7.
    Fonts The CSS font-familyproperty defines the font to be used for an HTML element. <h1 style="font-family:century gothic;">Lyceum of Alabang</h1> <p style="font-family:arial;">School Year 2020-2021</p>
  • 8.
    Text Size The CSSfont-size property defines the text size for an HTML element. <h1 style="font-size:100px;">Lyceum of Alabang</h1> <p style="font-size:25px;">School Year 2020-2021</p>
  • 9.
    Text Alignment The CSStext-align property defines the horizontal text alignment for an HTML element. <h1 style="text-align:center;">Lyceum of Alabang</h1> <p style="text-align:center;">School Year 2020-2021</p>