View video tutorial

CSS Inline CSS

CSS

An inline style only applies to a single HTML element.

Inline CSS


➔ CSS styles can be applied to HTML documents in 3 ways:

➔ Inline - Uses style attributes inside HTML elements.

Internal - Uses a <style> element in the <head> section.

External - Uses a <link> element to link to an external CSS file.

Inline Style

➔ An inline CSS uses the style attribute of a single HTML element.

Syntax
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8" />
    <title>CSS Inline Example</title>
</head>
<body>
    <h3 style="color:blue;">CSS Inline Example</h3>
    <p style="color:red;">Selectors are used to select one or more HTML elements that we want to style.
        There are five categories of selectors that are used to select elements.</p>
</body>
</html>

Example

<h3 style="color:blue;">CSS Inline Example</h3>
<p style="color:red;">Selectors are used to select one or more HTML elements that we want to style.
  There are five categories of selectors that are used to select elements.</p>
Try it Now »

Click on the "Try it Now" button to see how it works.