W3c markup validation is asking me to remove trailing slashes on my page. Is this correct? Aand will my page still be compliant in all browsers?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="content-style-type" content="text/css" **/**>
A trailing slash at the end of a URL on your website can cause issues with duplicate content if not dealt with correctly. Put simply, Google doesn't like seeing the same content on different pages. It can be confusing for both search engines and users.
Historically, a trailing slash marked a directory and a URL without a trailing slash at the end used to mean that the URL was a file. Today, however, trailing slashes are purely conventional, and Google does not care whether you use them; as long as you're consistent.
<meta> HTML Tag The <meta> element is used to add machine-readable information to an HTML document. Information added with the <meta> tag is not displayed to website visitors but is provided for use by browsers and web crawlers. This element must not contain any content, and does not need a closing tag.
If your site has a directory structure, it's more conventional to use a trailing slash with your directory URLs (for example, example.com/directory/ rather than example.com/directory ), but you can choose whichever you like. Be consistent with the preferred version. Use it in your internal links.
That is correct. For HTML 4.01 you shouldn't have trailing slashes (self-closing tags) for meta
elements and I believe <link>
elements if memory serves me correctly.
xhtml requires trailing slashes, though.
XHTML
is HTML
with an XML
syntax. In XML all tags must be closed. Some HTML tags do not have closing tags so in XHTML they need to be self closed. This is achieved through placing an /
in front of the >
.
So any tags that you have with />
must be changed to remove the forward slash to be HTML conformant.
These aren't the only differences between the two specifications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With