Inline Styles in CSS3 with Example

cssFor Inline Styles, we make use of style attribute.  You can apply one or more styles directly to an element in HTML.  The syntax for a CSS style is given below with an example.

property_name:value;

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<head>
<title>CSS Tutorials</title>
</head>
<body>
<div style="background-color: red;font-weight: bold;">Hello World!</div>
</body>
</html>
<!DOCTYPE html> <html> <head> <title>CSS Tutorials</title> </head> <body> <div style="background-color: red;font-weight: bold;">Hello World!</div> </body> </html>
<!DOCTYPE html>
<html>
<head>
<title>CSS Tutorials</title>
</head>
<body>
<div style="background-color: red;font-weight: bold;">Hello World!</div>
</body>
</html>