HTML Styles

You are currently viewing HTML Styles

HTML Styles

HTML Styles

HTML is primarily used to define the structure of the web page While Cascaded style sheets (CSS) are a language that is used for the presentation of HTML Pages.

Using CSS in HTML, we can change colors, fonts, and other kinds of formatting on a web page. There are many different ways to include CSS in an HTML page. We will see a simple way to apply CSS Rules in the HTML Document.

HTML anchor Tag

The HTML <a> tag is used to create hyperlinks, which allow users to navigate between web pages.

Here is an example of how to use the <a> tag:

				
					<a href="https://www.example.com" target="_blank" rel="noopener">Click here to visit Example.com</a>

				
			

HTML is primarily used to define the structure of the web page While Cascaded style sheets (CSS) are a language that is used for the presentation of HTML Pages.

Using CSS in HTML, we can change colors, fonts, and other kinds of formatting on a web page. There are many different ways to include CSS in an HTML page. We will see a simple way to apply CSS Rules in the HTML Document.

Syntax

You can use style attributes to apply CSS to any HTML page.

				
					style="property: value;"
				
			

HTML Background Color

We can set background colors for various HTML Elements.

 

The background-color property is used to define the background color.

Example of HTML Styles – Background Color

				
					<body style="background-color:lightblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
				
			

HTML Text Color

We can change the color of the text using color properties in any HTML element.

Example of HTML Text color

				
					<h1 style="color:black;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
				
			

HTML Fonts

The font-family property is used to define the font types for an HTML element.

Example of HTML Font

				
					<h1 style="font-family:arial;">This is a heading</h1>
<p style="font-family:Times New Roman;">This is a paragraph.</p>

				
			

HTML Text Size

The font-size property defines the text size for an HTML element.

Example of HTML Text Size

				
					<h1 style="font-size:15px;">This is a heading</h1>
<p style="font-size:20px;">This is a paragraph.</p>
				
			

HTML Text Alignment

he text-align property is used to set a horizontal text alignment for an HTML element.

Example of HTML Text Alignment

				
					<h1 style="text-align:right;">right heading</h1><p style="text-align:center;">This is a paragraph.</p>
				
			

Leave a Reply