Computer >> Computer tutorials >  >> Programming >> HTML

How to use inline CSS style for an element in HTML?


Use the style attribute to set the inline CSS style. The following is the syntax −

Syntax

<element style="mystyles">

Here, mystyles are one or more CSS properties. Separate them with semicolons.

Example

You can try to run the following code to implement inline CSS style for an element in HTML −

<!DOCTYPE html>
<html>
   <body>
      <h1 style = "color:white;background-color:black">Tutorialspoint</h1>
      <h2>Simply Easy Learning</h2>
      <p>We provide free learning content.</p>
   </body>
</html>