HTML · Document structure

base

Sets a base URL for every relative link and resource in the document. Use it once, at most.

Syntax
<base href="https://example.com/">

Example

Try it

Notes

base also changes where relative fragments resolve, which often surprises people. Prefer absolute URLs.

More in this group

<!doctype html> body head html link meta charset meta description meta robots

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course