CSS
Nov 15, 2024 5 min
Code & Typography
Markdown Code Design
We consume content at a staggering rate. But are we actually reading? Or are we just scanning? In this essay, I explore the impact of typography on reading comprehension.
Typography Principles
When designing for the web, we must consider:
- Hierarchy: Using size and weight to guide the eye.
- Contrast: Ensuring text is legible against the background.
- Spacing: Giving elements room to breathe.
Code Example
Here is a snippet of TypeScript code that demonstrates how we handle the layout:
interface LayoutProps {
children: React.ReactNode;
isMobile: boolean;
}
const Layout: React.FC<LayoutProps> = ({ children, isMobile }) => {
return (
<div className={isMobile ? 'p-4' : 'p-8'}>
{children}
</div>
);
};
And here is some CSS:
.card {
background: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
padding: 2rem;
}
Variable Fonts
With the advent of variable fonts and better CSS support for typesetting, the web is finally catching up to print.
M
Twany
Writing about the web since 2004.