How To Give Color To Text In HTML
Last Updated : Jan 1, 2023
IN - HTML
In this tutorial we will show you how to give color to text in HTML, in HTML, you can also use the colors to fonts or text. This may help you to create a webpage creative and more colorful.
There are some steps which you have to follow to give color to text. You can apply any color to text in html weather it is in any tag.
Step By Step Guide On How To Give Color To Text In HTML :-
As, there are many ways to apply color to any text in html. This can be done with the help of color attribute, you have to it’s the color name as its value.
But there are some color codes like rgb, rgba and #EEE color codes. In this article we will describe you the easiest way to apply a color.
In next articles, we will also help you to understand about rgb colors, and the color codes of # (hash tag). In this article, we will specify the simple way to give a color to text.
<!DOCTYPE html> <html> <head> <title> Title of the document<title> </head> <body> <p style="color:pink"> this is mine para </p> <h1 style="color: grey;"> this is heading tag, you can use any heading </h1> <div style="color: lightcoral;"> you can also use div </div> </body> </html>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here. Here, we create three different tags that are paragraph, heading and division to show you that a color can be applied to any text it does not matter that what the tag is used.
- And in the tags, we will write the text here, which we want to show on webpage you can use any text, after this in the opening tag we have to write the style attribute which is a part of CSS, this is inline CSS and you can use any according to your choice.
- In the style attribute, we use a color property, and after this we give the color name as value to attribute. There are many color in html, you can use any font there name you also can get the help of internet and other source which you use.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
In conclusion, here we find that you can apply color to any font in html, there are many ways to apply color. Like we can use color name, color codes and there rgb values also.
Before color name is the most easiest way, you can find more color name through internet also. I hope this tutorial on how to give color to text in HTML helps you.