CodePrimer
Search a living directory of web syntax. Pick a problem, copy a working sample, then adapt it.
CSS
Beginner
Simple CSS transition
How do I animate hover smoothly?
PHP
Beginner
Combined assignment operators
What does += mean in PHP?
JavaScript
Beginner
Read input/select/textarea values
How do I read form field values in JS?
HTML
Beginner
Select dropdown
How do I make a dropdown menu?
CSS
Beginner
Truncate long text with ellipsis
How do I cut overflow text with …?
PHP
Intermediate
Local vs global scope
Why can’t my function see an outside variable?
CSS
Beginner
Max-width page container
How do I keep content from stretching too wide?
JavaScript
Beginner
Read data-* with dataset
How do I read data-price in JavaScript?
HTML
Beginner
Textarea multi-line input
How do I collect long comments?
HTML
Beginner
Date, hidden, and file inputs
What special input types should I know?
JavaScript
Beginner
mouseover tooltip style
How do I run code on hover?
CSS
Beginner
Simple CSS reset start
How do I normalize browser defaults a bit?
PHP
Intermediate
Static variable in a function
How do I keep a value between function calls?
HTML
Beginner
GET vs POST forms
When should a form use GET or POST?
PHP
Beginner
if / elseif / else
How do I branch logic in PHP?
JavaScript
Beginner
Keyboard keydown shortcut
How do I listen for a key press?
CSS
Beginner
Space-between header layout
How do I put logo left and links right?
HTML
Beginner
Custom data-* attributes
How do I store extra data on an element?