What is Inline Style in CSS?

For general web development questions using HTML and CSS.
Post Reply
admin
Site Admin
Posts: 44

What is Inline Style in CSS?

Post by admin » Tue May 19, 2020 2:20 am

Inline Styles - Use inline styles to apply styling to a specific element. Note that this is not optimal. Placing style rules in a <style> tag or external CSS file is encouraged in order to maintain a distinction between content and presentation.

Inline styles override any CSS in a <style> tag or external style sheet. While this can be useful in some
circumstances, this fact more often than not reduces a project's maintainability.

The styles in the following example apply directly to the elements to which they are attached.

Code: Select all

<h1 style="color: green; text-decoration: underline;">Hello world!</h1>
<p style="font-size: 25px; font-family: 'Trebuchet MS';">I ♥ CSS</p>
Inline styles are generally the safest way to ensure rendering compatibility across various email clients, programs
and devices, but can be time-consuming to write and a bit challenging to manage.

Learn about external stylesheets - viewtopic.php?f=7&t=449
Learn about internal stylesheets - viewtopic.php?f=7&t=450

Post Reply