How to use Internal CSS In HTML

This approach involves defining the style within the <style> tag in the HTML document. For example, to set the background color of a paragraph to yellow using internal CSS, you would use the following syntax.

Syntax:

<style>
element {
background-color: yellow;
}
</style>

Example: Implementation to change the background colour.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Using Internal CSS</title>
    <style>
        body{
            background-color: green;
        }
    </style>
</head>
 
<body>
    <h1>w3wiki</h1>
    <h3>Using Internal CSS for Background change</h3>
</body>
 
</html>


Output:



How to Change Background Color in HTML without CSS ?

In HTML, you can change the background color of an element using the bgcolor attribute. However, it’s important to note that the bgcolor attribute is deprecated in HTML5 and should be avoided in favor of using CSS for styling.

Table of Content

  • Using bgColor Attribute
  • Using Inline Styling
  • Using JavaScript
  • Using Internal CSS

Similar Reads

Using bgColor Attribute

In HTML, you can change the background color of an element using the bgcolor attribute. This approach involves directly adding the bgcolor attribute to the HTML element and specify the desired background color....

Using Inline Styling

...

Using JavaScript

In HTML, you can change the background color of an element using inline styling. This approach involves directly adding the `style` attribute to the HTML element and specifying the desired background colour using the ‘background-colour’ property....

Using Internal CSS

...

Contact Us