Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Frontend Guidelines
Search
Ricardo Andrés Bello
September 02, 2015
Programming
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Frontend Guidelines
HTML and CSS good practices and what NOT to do (:
Ricardo Andrés Bello
September 02, 2015
More Decks by Ricardo Andrés Bello
See All by Ricardo Andrés Bello
Rails Frontend Optimisations (part 2)
ricardoaandres
0
77
How Browsers Render
ricardoaandres
0
99
Bower + Rails
ricardoaandres
0
140
Rails Frontend Optimisations (part 1)
ricardoaandres
0
75
Other Decks in Programming
See All in Programming
JIS keyboard support in Omarchy
lef237
0
120
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
310
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
The Rails Doctrine Decade
koic
2
590
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
ActionController meets Protocol Buffers
sorah
0
530
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
480
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
How to train your dragon (web standard)
notwaldorf
96
6.9k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
Making Projects Easy
brettharned
120
6.8k
Test your architecture with Archunit
thirion
2
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Marketing to machines
jonoalderson
1
5.9k
Leo the Paperboy
mayatellez
10
2.4k
Transcript
FRONTEND GUIDELINES
HTML
SEMANTICS <h1> <figure> <img alt=‘Company’ src=‘logo.png’> </figure> </h1> <h1> <img
alt=‘Company’ src=‘logo.png’> </h1> <!-- bad --> <!-- good -->
<div id=‘main’> <div class=‘article’> <div class=‘header’> <h1>Blog post</h1> <p>Published: <span>21st
Feb, 2015</span></p> </div> <p>…</p> </div> </div> <main> <article> <header> <h1>Blog post</h1> <p>Published: <time datetime=‘2015-02-21’>21st Feb, 2015</time></p> </header> <p>…</p> </article> </main> <!-- bad --> <!-- good --> SEMANTICS
<meta http-equiv=Content-Type content=‘text/html; charset=utf-8’ /> <link rel=‘stylesheet’ href=‘style.css’ type=‘text/css’ />
<input type=‘email’ placeholder='
[email protected]
’ required=‘required’ /> <script src=‘main.js’ type=‘text/javascript’></script> <meta charset=‘utf-8’> <link rel=‘stylesheet’ href=‘style.css’> <input type=‘email’ placeholder='
[email protected]
’ required> <script src=‘main.js’></script> <!-- good --> <!-- bad --> BREVITY
<h1><img alt=‘Logo’ src=‘logo.png’></h1> <div class=‘button’></div> <h1><img alt=‘Acid Labs’ src=‘logo.png’></h1> <button></button>
<!-- good --> <!-- bad --> ACCESSIBILITY
<!doctype html> <html> <head> <title></title> </head> </html> <!doctype html> <html
lang=‘en’> <head> <meta charset=‘utf-8’> <title></title> </head> </html> <!-- good --> <!-- bad --> LANGUAGE
<!doctype html> <html> <head> <title></title> <script src=analytics.js></script> </head> </html> <!doctype
html> <html lang=‘en’> <head> <meta charset=‘utf-8’> <title></title> </head> <body> <script src=analytics.js></script> </body> </html> <!-- good --> <!-- bad --> PERFORMANCE
CSS
SEMI COLONS div { color: red } div { color:
red; } /* bad */ /* good */
NATURAL FLOW img { display: block; } img { vertical-align:
middle; } /* bad */ /* good */
NATURAL FLOW div { width: 100px; position: absolute; right: 0;
} div { width: 100px; margin-left: auto; } /* bad */ /* good */
SELECTORS div:first-of-type :last-child > p ~ * div:first-of-type .info /*
bad */ /* good */
SELECTORS img[src$=svg], ul > li:first-child { opacity: 0; } [src$=svg],
ul > :first-child { opacity: 0; } /* bad */ /* good */
SPECIFICITY .bar { color: green !important; } .foo { color:
red; } .foo.bar { color: green; } .foo { color: red; } /* bad */ /* good */
OVERRIDING li { visibility: hidden; } li:first-child { visibility: visible;
} li + li { visibility: hidden; } /* bad */ /* good */
INHERITANCE div h1, div p { text-shadow: 0 1px 0
#fff; } div { text-shadow: 0 1px 0 #fff; } /* bad */ /* good */
LANGUAGE :nth-child(2n + 1) { transform: rotate(360deg); } :nth-child(odd) {
transform: rotate(1turn); } /* bad */ /* good */
BREVITY div { transition: all 1s; top: 50%; margin-top: -10px;
padding-top: 5px; padding-right: 10px; padding-bottom: 20px; padding-left: 10px; } div { transition: 1s; top: calc(50% - 10px); padding: 5px 10px 20px; } /* bad */ /* good */
PREFIXES div { transform: scale(2); -webkit-transform: scale(2); -moz-transform: scale(2); -ms-transform:
scale(2); transition: 1s; -webkit-transition: 1s; -moz-transition: 1s; -ms-transition: 1s; } div { -webkit-transform: scale(2); transform: scale(2); transition: 1s; } /* bad */ /* good */
ANIMATIONS div:hover { animation: move 1s forwards; } @keyframes move
{ 100% { margin-left: 100px; } } div:hover { transition: 1s; transform: translateX(100px); } /* bad */ /* good */
UNITS div { margin: 0px; font-size: .9em; line-height: 22px; transition:
500ms; } div { margin: 0; font-size: .9rem; line-height: 1.5; transition: .5s; } /* bad */ /* good */
COLORS div { color: hsl(103, 54%, 43%); } div {
color: #5a3; } /* bad */ /* good */
DRAWING div::before { content: url(white-circle.svg); } div::before { content: "";
display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; } /* bad */ /* good */
None