Created
February 17, 2015 14:26
-
-
Save mikedamage/b941496386799e6a40c5 to your computer and use it in GitHub Desktop.
Inline styles vs. classes and external stylesheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is bad for business: --> | |
<p style="margin: 15px;"> | |
<strong style="color: #f00;">This is important!</strong> | |
<span style="color #ccc;">This isn't.</span> | |
</p> | |
<!-- Instead, define a class with a semantic, descriptive name, and style it in an external stylesheet: --> | |
<!-- in <head>: --> | |
<link rel="stylesheet" href="style.css"> | |
<!-- in <body>: --> | |
<p class="indent"> | |
<strong class="important">This is important!</strong> | |
<span class="unimportant">This isn't.</span> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.indent { | |
margin: 15px; | |
} | |
.important { | |
color: #f00; | |
} | |
.unimportant { | |
color: #ccc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment