- Used to define a base URL for relative links within the document
- Can only be one base element
- Must be contained within the <head> element
- Does not have a closing tag, therefore requires a closing forward slash
Example showing the relative path being used with the src attribute:
<!DOCTYPE html> <html> <head> <title>My Document Title</title> <base href="https://html.tech-academy.co.uk/"/> </head> <body> <img src="/images/HTML5_logo.png"> </body> </html>
Save & refresh browser:
![]() |