I am seeing the words “head” and “header” mentioned here. Is there a difference? I was wondering if it is really important to always put the charset in the meta tag, and not have in the HTML?
head is the declaration for
header is an
HTML element. Normally, it’s used to wrap around
I personally don’t think it’s important. But if you’re into
SEO, then apparently it’s important.
If you’re worried about the speed of your website, as per your previous post, I wouldn’t worry about it. The size of your images, on the other hand, need addressing…
(I searched for “html lang” and found the second entry to be: )
Declaring language in HTML
Always use a language attribute on the html tag to declare the default language of the text in the page. When the page contains content in another language, add a language attribute to an element surrounding that content.
If you want to create metadata that describes the language of the intended audience of a page, rather than the language of a specific range of text, do so by getting the server to send the information in the HTTP Content-Language header. If your intended audience speaks more than one language, the HTTP header allows you to use a comma-separated list of languages.
In the past many people used a meta element with the http-equiv attribute set to Content-Language. Due to long-standing confusions and inconsistent implementations of this element, the HTML5 specification made this non-conforming in HTML, so you should no longer use it.
Always declare the encoding of your document using a meta element with a charset attribute, or using the http-equiv and content attributes (called a pragma directive). The declaration should fit completely within the first 1024 bytes at the start of the file, so it’s best to put it immediately after the opening head tag.
Yes, there’s a difference.
<head> is part of the basic structure of a web page. e.g.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Page title goes here</title> </head> <body> Content to be displayed goes here. </body> </html>
Meta tags, links to style sheets, any embedded CSS styles, etc. all belong in the head section, with the charset and title, both of which are required.
<header> is an HTML tag which can be used to group heading information on the page.
That question comes from the GTMetrix analysis. I shrank the picture file to speed the load-in, as well. Was going to switch out the files to the site later on, but my lawnmower threw a block of wood at my ankle, so here I am now, doing this.
If you don’ t specify a charset, then the browser assumes what about it?
I’m assuming that if all of your text is only ASCII then most should “guess” OK. But if you have any non-ASCII characters then maybe, maybe not.
For a contrived example, if you have “senor” that should display OK even without specifying a charset. But if you have “señor” some may display it as “señor” but some may display it more like “seÂ§or” (a double bit character as two separate single bit characters).
That may well depend upon the browser. They will probably “guess” at either UTF-8 or ISO-8859-1.
I suggest you read the section on charset here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
It is strongly recommended to define the character encoding. If a page’s encoding is undefined, cross-scripting techniques are possible, such as the UTF-7 fallback cross-scripting technique.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.