Examples of Inline CSS
This example demonstrates the styling like color, font and text alignment using inline css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Inline CSS</title>
</head>
<body>
<h1 style="color: green;
font-size: 60px;
text-align: center;">
w3wiki
</h1>
<p style="color: gray;
font-size: 25px;
text-align: center;">
A computer science portal..!
</p>
</body>
</html>
Output:
In this example, we use inline CSS to provide colors to your given p tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Inline CSS</title>
</head>
<body>
<p style="color: green;">
HTML
</p>
<P style="color: red;">
CSS
</P>
<p style="color: blue;">
JavaScript
</p>
</body>
</html>
Output:
Inline CSS
Inline CSS is a method that applies CSS styling directly to HTML elements using the ‘style’ attribute. This approach allows developers to define styles for individual elements, making it an effective tool for applying unique styles to specific HTML elements.
Syntax:
<tag style = " "></tag>
Table of Content
- When to Use Inline CSS ?
- How to use inline CSS ?
- Examples of Inline CSS
- Advantages
- Disadvantages
Contact Us