HTML COLORS

Fazzey's world

HTML Colors

  • HTML colors can used  to edit for the documents.
  • For your website to have a pleasing appearance and feel, colors are crucial. 
  • Using the <body> tag, you can set the colors for the entire page.




Background color:

  • The background-color attribute to set the colors for specific tags
  • The bgcolor is a sets of colors for the background of the page like, headers and paragraphs tag.

Example:

 
  <!DOCTYPE html>
  <html>
  <head>
  <title>HTML</title>
  </head>
  <body>
  <h1>Background Colors</h1>
  <h2 style ="background-colorpurple;">Purple color</h2>
  <h2 style ="background-colorpink;">Pink color</h2>
  <h2 style ="background-color: blue;">Blue color</h2>
  <h2 style ="background-color: green;">Green color</h2>
  </body>
  </html>
    



  Output:



Text Color:

  • To change the color of a text using an inline style attribute which is to be displayed on a web page.
  • We can using this color for the text in HTML document.


Example:



  <!DOCTYPE html>
  <html>
  <head>
  <title>HTML</title>
  </head>
  <body>
  <h1>Text Color</h1>
  <h2 style ="colortomato;">This is a tomato color for the text</h2>
  <h2 style ="colorlightpink;">This is a lightpink color for the text</h2>
  <h2 style ="colorskyblue;">This is a skyblue color for the text</h2>
  </body>
  </html>


Output:



Border Color:

  • HTML documents can use border we can give styles to them.We can give width, style and color for the border.
  • The border-color property is used to set the color of a border, like border - specifies a color name, like "red".

Example:


  
  <!DOCTYPE html>
  <html>
  <head>
  <title>HTML</title>
  </head>
  <body>
  <p style ="border3px solid red;"> This is red border.</p>
  <p style ="border3px solid yellow;"> This is yellow border.</p>
  <p style ="border3px solid blue;"> This is blue border.</p >
  </body>
  </html>


Output:




Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send