Is receiving an error message about a "stray start tag footer" in your HTML validator?

I am perplexed by the error message I am receiving:

Stray start tag footer.

All I have included here is the tags:

<!doctype html>

<head>
    <title>title</title>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
    <img src="heading.jpg" width="840" alt="pic">
    <!--<div id="container"></div> used ot set width of page -->
    <nav>
        <div id="columns">
            <a href="index.html">Home</a>
            <a href="products.html">Products</a>
            <a href="gift_ideas.html">Gift Ideas</a>
        </div>
        <br>
        <div id="link">
            <a href="link1.html">link1</a>|<a href="link2.html">link2</a>|<a href="link3.html">link 3</a>
        </div>
    </nav>
    <section>
        <br>
        <div id="homePage">
            <h1>Welcome</h1>
            <br>
            <div id="cart">
                <img src>
            </div>
        </div>
    </section>
</body>
<footer>
    <br>
    <h2>Contact Us</h2>
    Email: <a href="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="57323a363e3b17322f363a273b3279343879392d">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32575f535b5e72574a535f425e571c515d1c5c48">[email protected]</a></a>
    <img src>
</footer>

I meticulously checked for any unclosed tags, so why is there an issue with the footer?

Answer №1

To ensure correct HTML structure, it is important to place the closing </body> tag at the very end of the document. This is because a footer element should be positioned within the body element according to the guidelines specified in the root element, which is the html element. The html element consists of a head and body element only, no additional elements.

The reason for the validator error stating “Stray start tag footer” is that the start tag appears in an invalid context where no new elements can be initiated – specifically after the </body> tag, where only the optional </html> tag is allowed.

Answer №2

There were missing <html> tags, so they have been added. Also, the <footer> has been brought inside the <body> tag for proper structure. It seems you are using <br> tags to create space between elements, but it is recommended to use CSS for adjusting the margin properties instead.

Here is the complete corrected code:

<!doctype html>
<html>
<head>
    <title>title</title>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
    <img src="heading.jpg" width="840" alt="pic">
    <nav>
        <div id="columns">
            <a href="index.html">Home</a>
            <a href="products.html">Products</a>
            <a href="gift_ideas.html">Gift Ideas</a>
        </div>
        <div id="link">
            <a href="link1.html">link1</a>|<a href="link2.html">link2</a>|<a href="link3.html">link 3</a>
        </div>
    </nav>
    <section>
        <div id="homePage">
            <h1>Welcome</h1>
            <div id="cart">
                <img src>
            </div>
        </div>
    </section>
    <footer>
        <h2>Contact Us</h2>
        Email: <a href="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5d38303c34311d38253c302d3138733e32733327">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="42272f232b2e02273a232f322e276c212d6c2c38">[email protected]</a></a>
        <img src>
    </footer>
</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to iterate through all elements using xpath

Having recently ventured into the world of xpath and HTML, I realize that I may be overlooking a key concept. In my HTML document, I am aiming to extract all the items listed below (I'm relying on scrapy for my requests; all I need is the correct xpat ...

The appearance of a printed webpage does not match what is shown in Google Chrome's Print Preview feature

I have encountered a strange issue that has me stumped. I need the webpage in my current project to be completely printable, but I'm facing difficulties. While the signature field and note field (with the text "erererer") display perfectly in Google C ...

How can I make my Twitter Bootstrap carousel actually start "carousel"-ing?

I often find myself in over my head with programming, but I am giving it my best shot. Please be patient with me! Recently, I followed a tutorial on YouTube to create a carousel in my Django project. Unfortunately, instead of displaying one image at a ti ...

Can you explain the functionality of $on.constructor in AngularJS?

Recently, I attempted an XSS challenge on the PortSwigger labs website. You can find the challenge here. This is my solution to the XSS challenge: {{$on.constructor('alert(1)')()}} However, since I have no prior experience with AngularJS, I&apo ...

Struggling with the navbar-toggler in Bootstrap 4 Beta 2?

As part of my Bootstrap practice, I have implemented a navbar on my webpage. However, I am facing issues with the nav-bar toggler not working for small screens and the icon navbar-toggler-icon not appearing. Below is my current navbar code: <nav class ...

Is there a way to modify the styling for ListItemButton specifically when it is in a selected state?

My first experience with MUI involves trying to customize the styling of a button. After installing my project with default emotion as the styling engine, I attempted to override the existing styles using the css() method mentioned in the documentation: ...

Show the chosen item from a dropdown menu using Bootstrap

Here is the HTML code that I am working with: <!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="h ...

"Implementing jQuery to dynamically set the href attribute for a link when

My website features a tabbed menu that displays content from various WordPress categories including Cars, Trucks, and Buses. The active tab is randomly selected each time the page is reloaded. However, there seems to be an issue with the "View More" button ...

Text appears unclear and fuzzy when using Firefox browser

While my website looks fine on Chrome and Opera, it appears blurry on Internet Explorer and Firefox. I've tried researching and applying different CSS styles, but nothing seems to work. Both my Firefox and Internet Explorer versions are up to date, an ...

Joomla, Enhancement for iFrame Sizing

A close associate who runs his own construction business has asked me to create a website for him using Joomla. I have successfully implemented most of the features he wanted, but now I need some assistance. He wants to showcase references written about hi ...

Display the user's input value in a tooltip without using jQuery

I am looking to achieve this particular layout design. https://i.stack.imgur.com/p9UTH.jpg I am unsure about how to display the input value in the bubble within this layout. The visibility of the bubble should only be triggered on hover. Below is the cod ...

What is a way to include a ":hover" effect in Elm without relying on signals?

I'm looking to apply a :hover style to an element using Elm's HTML library. I've considered using Signals and Sets to manage selected nodes, but it feels like overkill for such a simple task. Another option is adding an external stylesheet, ...

Is it possible to utilize HTML as a platform for interfacing with a C/C++ program?

As I work on a new product with USB interface, I need to create a control app for it. However, my GUI programming skills are limited, so I have thought of using a local web page within the app's installation directory as the interface for the program. ...

Combining two kebab-case CSS classes within a React component

import React from 'react'; import styles from './stylesheet.moudle.css' <div className={styles['first-style']} {styles['second-style']}> some content </div> What is the correct way to include styles[&ap ...

Demonstrating the transformation of child elements into parent elements through angular 6 ngFor

I have a JSON array dataset where each object may contain nested arrays. In order to display the inner nested array elements as part of the parent array using Angular's NgFor, I need to format the input like this: [{ 'id': 1, 'tit ...

The themes showcased in the Bespoke.js documentation and demo exhibit unique designs

Recently, I stumbled upon an incredible HTML5 framework for presentations. For more information, you can check out the documentation here. You can also view a demo of the framework by visiting this link. However, I was disappointed to find that the caro ...

I am curious if there is a feature in intro.js that allows for the highlighting of text or images to

I am having trouble getting intro.js to work with Ionic 4 as the highlighted text is not showing up view image here This is how I implemented the code in Angular 7: intro() { let intro = introJs.introJs(); intro.setOptions({ exitOnOverlayClick: false, ...

What is the method for incorporating opacity into the background color CSS attribute using a Fluent UI color?

Currently, my challenge involves applying opacity to a background color sourced from the fluent UI library, which utilizes Design Tokens. Typically, I would add opacity to a background color like this: background-color: "rgba(255, 255, 255, 0.5)" However ...

Developing a customized WordPress walker to specifically target the first and last links

I've implemented a custom walker in my Wordpress site: class Custom_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { if ( $depth ) $indent = str_repeat("& ...

The stylesheet's URL reference to the image is not functioning properly

I'm attempting to showcase images inside a table cell using CSS. Here's what I currently have: HTML: <td class="activity-status status_not_started">Not Started</td> CSS: td.activity-status { font: 0/0 a !important; color: transpar ...