A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-base-href-attribute/ below:

HTML <base> href Attribute - GeeksforGeeks

HTML <base> href Attribute

Last Updated : 11 Jul, 2025

HTML <base> href Attribute specifies the base URL for all relative URLs in a document, serving as the reference point for resolving relative links and resources.

Syntax: 

<base href="URL">

Attribute Values:

It contains the value i.e URL which specifies the absolute URL that defines the base URL of the page. for eg."www.geeksforgeeks.org" 

HTML <base> href Attribute Examples

Example 1: This Example illustrates the use of the href attribute in an element. 

HTML
<!DOCTYPE html>
<html>

    <head>
        <!-- Declaring the BASE URL -->
        <base href=
"https://media.geeksforgeeks.org/wp-content/uploads/"
              target="_blank">
    </head>
    <h1>GeeksForGeeks</h1>
    <h2>
        HTML base href Attribute
    </h2>

    <body>
        <img src="1-95.jpg" 
             width="400" 
             height="250">
    </body>

</html>

Output:

Supported Browsers

The browser supported by HTML <base> href Attribute are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4