Sunday, March 28, 2021

HTML Styling | html Style Attributes (Color, Font, Size, Alignment )



HTML Styles




  HTML Styling  
Every HTML element has a default style background color is white, text color is black, text-size is 12px You Can Changing the of an HTML element default style with the style attribute. Below this example we will changes the default background color from white to magenta:


HTML CODE EXAMPLE : Change HTML web page default background color



Note : The bgcolor attribute, supported in older versions of HTML, is not valid in HTML5.


  The HTML Style Attribute  
HTML style attribute syntax 
HTML CODE EXAMPLE : HTML Style Attribute syntax

Here The property is a CSS property and The value is a CSS value.
Note: You will learn more about CSS later in this tutorial.


  HTML Text Color  
In HTML color property describe the text color to be used for an HTML element

HTML CODE EXAMPLE : HTML Text Color




  HTML Text Fonts  

In HTML font-family property describe the font to be used for an HTML element.



HTML CODE EXAMPLE : Font-Family Property



Note: The <font > tag, supported in older versions of HTML, is not valid in HTML5.


  HTML Text Size  

In HTML font-size property describe the text size to be used for an HTML element.

HTML CODE EXAMPLE : HTML Text Size






  HTML Text Alignment  

In HTML the text-align property describe the horizontal text alignment for an HTML element

HTML CODE EXAMPLE : HTML Text Alignment



Note: The <center> tag, supported in older versions of HTML, is not valid in HTML5.


Chapter Summary


Use the style attribute for styling HTML elements
Use background-color property for background color
Use color property for text colors
Use font-family property for text fonts
Use font-size property for text sizes
Use text-align property for text alignment