Sub topic 1
Designing Buttons and Links That Look Clickable
Prerequisites
Assume you know basic HTML elements and attributes, CSS selectors, the box model, colors, and pseudo-classes. You should also know how to inspect an element with browser developer tools.
Why some elements look clickable and others do not
An affordance is a property that suggests how something can be used. A door handle affords pulling. A signifier is a visible cue that communicates that possibility. A raised, filled shape can signpost a button; an underline can signpost a link.
Users learn these patterns from other websites. When a control has no border, contrast, underline, spacing, or state change, users may mistake it for plain text. Visual styling should reinforce the element's real behavior rather than make every element look interactive.
Buttons or links: pick the element by what it does
Use a link when activating it navigates to a URL, such as a document, product page, or account screen. Use a button when activating it performs an action on the current page, such as saving, opening a dialog, or submitting a form.
<a href="/docs/getting-started">Read the getting started guide</a>
<button type="button">Save changes</button>Do not use a button for navigation just because it is easier to style. Do not use a link for an action and then replace its normal behavior with JavaScript. Correct semantics provide keyboard behavior, browser features, and better support for assistive technology.
Contrast and color: making the cue visible to everyone
Color alone is not a sufficient signifier. Keep underlines on inline links, and give buttons a visible border or filled surface. Check both text and boundaries against their backgrounds. A useful baseline is 4.5:1 contrast for normal text and 3:1 for large text or meaningful graphical boundaries.
Designing a button that reads as pressable
A button usually needs a clear shape, internal padding, and a state change. A minimum height of 44 pixels gives touch users a practical target. Keep enough space between adjacent controls to reduce accidental taps.
.btn {
min-height: 44px;
padding: 0 1.25rem;
border: 2px solid #1d4ed8;
border-radius: 8px;
background: #1d4ed8;
color: #fff;
font: inherit;
font-weight: 600;
cursor: pointer;
}
.btn:hover {
background: #1e40af;
}
.btn:focus-visible {
outline: 3px solid #1d4ed8;
outline-offset: 3px;
}The filled surface signals pressability. The focus outline makes keyboard interaction visible. Later, add active, disabled, and loading states without removing the control's label or layout.
Exercise
Which element should you use for a control that opens a settings dialog without changing the URL?
Show answer
Use a button, because it performs an action on the current page.