Inline CSS Style
Inline CSS style is the practice of applying CSS style directly to individual HTML elements using the "style" attribute.
For inline CSS style, you need not to create separate CSS file or use a style tag in the document's head.
You can apply CSS style to the specific element within its HTML tag.
How to Add Inline CSS Style to an HTML Element
First create a paragraph element as shown below:
<p>You can use the style attribute within an HTML element to apply CSS directly to that specific element.</p>
In the opening tag of the paragraph element, add style=""
attribute.
Set value color: red; font-size: 18px;
to the style attribute to define text color and font size of the paragraph element.
style="color: red; font-size: 18px;"
is the complete code of inline CSS style for the paragraph element.
Check the following example:
Example of Inline CSS Style
Output of the above example
Example of Inline CSS Style in a Webpage
CSS properties 'color' and 'font-size' style have been applied to the following paragraph.
You can use the style attribute within an HTML element to apply CSS style directly to that specific element.