Last active
January 2, 2016 15:39
-
-
Save mbseid/8324902 to your computer and use it in GitHub Desktop.
HTML/CSS guidlines
This file contains 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
<!-- Bad Code --> | |
<div class="validation"> | |
... | |
<button class="btn btn-danger">Delete</button> | |
</div> | |
<script> | |
$(".validation .btn-danger").on('click', function(){ ... }); | |
</script> | |
<!-- Good Code --> | |
<div class="validation"> | |
... | |
<button class="btn btn-danger js-delete-button">Delete</button> | |
</div> | |
<script> | |
$(".js-delete-button").on('click', function(){ ... }); | |
</script> |
This file contains 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
.validation{ | |
ul{ | |
list-style: none; | |
} | |
} | |
@media only screen and (max-width: 767px) { | |
@import "style/_small"; | |
} | |
@media only screen and (min-width: $mediumBreakpoint){ | |
@import "style/_medium"; | |
} | |
@media only screen and (min-width: $largeBreakpoint) { | |
@import "style/_large"; | |
} |
This file contains 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
<!-- Bad HTML --> | |
<div class="validation"> | |
<h2 class="validation-header">You have validation errors</h2> | |
<ul class="validation-list"> | |
<li>You need a name</li> | |
<li>A birthdate must be specified</li> | |
</ul> | |
... | |
</div> | |
<!-- Good Code --> | |
<div class="validation"> | |
<h2>You have validation errors</h2> | |
<ul> | |
<li>You need a name</li> | |
<li>A birthdate must be specified</li> | |
</ul> | |
... | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment