<base> Element

  • 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>
		<title>My Document Title</title>
		<base href="https://html.tech-academy.co.uk/"/>
		<img src="/images/HTML5_logo.png">

Save & refresh browser:

Leave a Reply