w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



base element, occurrences on page

Only 1 base element is allowed per HTML5 document.

Valid Syntax
1 base element present
1
2
3
4
5
6
7
8
9
10
<!doctype html>
<html>
<head>
<title>... <⁄title>
<base>
<⁄head>
<body>

<⁄body>
<⁄html>
Invalid Syntax
2 base elements present
1
2
3
4
5
6
7
8
9
10
11
<!doctype html>
<html>
<head>
<title>... <⁄title>
<base>
<base>
<⁄head>
<body>

<⁄body>
<⁄html>

Video demonstration base, occurrences

HTML5 base, occurrences on page, Tutorial

min video details
00:04 open html demo file in Notepad++
00:08 only 1 base element is allowed per html document and its place is in head section
00:12 warning: 4 base elements are present in page: 3 inside head section and 1 inside body section
00:22 when more than one base element is present on page, only the first one applies, the rest of them are ignored;
00:29 testing the page from server, everything looks fine;
01:09 if the first base element on page applies, the main.css final url should be: http://www.w3v-test.com/warning/main.css
and IT IS; check out the network request in web console
01:19 removing the extra base elements: the one from body section and 2 more form head section and SAVING the page
01:28 everything looks and is okay now
base intro base optional base browser display base parents all browsing contexts override browsing contexts base resolves only URLs.. base syntaxbase href attributebase target attribute