How to Center a Div
Use grid or flexbox to center content horizontally and vertically.
- Create a parent container
- Set display:grid or display:flex
- Align and justify the child
- Test on mobile sizes
.parent { min-height: 100vh; display: grid; place-items: center; }Try ItHow to Build a Responsive Navbar
Create a desktop nav that collapses cleanly on small screens.
- Use semantic nav markup
- Group links and actions
- Add a media query
- Test keyboard navigation
@media (max-width: 760px) { .links { display:none; } }Try ItHow to Fetch JSON from an API
Load JSON data from an endpoint and render it safely.
- Call fetch
- Check the response
- Parse JSON
- Render escaped values
const res = await fetch("/api/items");
const data = await res.json();Try ItHow to Handle a PHP Form
Read POST values, validate input, and return a safe response.
- Check request method
- Read POST values
- Validate and sanitize
- Store or respond
$name = trim($_POST["name"] ?? "");
Try ItHow to Use SQL JOINs
Combine related rows from two tables.
- Identify related keys
- Choose join type
- Select needed columns
- Add filters
SELECT users.name, orders.total FROM users JOIN orders ON orders.user_id = users.id;
Try ItHow to Think About Docker Deployment
Understand images, containers, ports, volumes, and environment variables.
- Build an image
- Run a container
- Set env vars
- Map ports
- Monitor logs
docker run --rm -p 8080:80 my-app
Try It