Inline CSS
~10 mins
Inline CSS
- 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.
- Placing style rules in a
<body>
<h1 style="color: green; ">Hello world!</h1>
</body>
-
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.
-
Reference: Section 1.4