CINXE.COM
HTML <head> Tag
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="HTML head tag, page header"> <meta name="Description" content="HTML head tag - represents the head section of the HTML document."> <link rel="canonical" href="https://www.quackit.com/html/tags/html_head_tag.cfm"> <title>HTML <head> Tag</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="shortcut icon" href="/pix/favicon96.png"> <link rel="apple-touch-icon" href="/pix/apple-touch-icon.png"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="/common/css/master.45.min.css" rel="stylesheet"> <script async src="https://cdn.fuseplatform.net/publift/tags/2/3499/fuse.js"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-Q3H025ZKLN"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-Q3H025ZKLN'); </script> </head> <body> <header class="site-header"> <div class="site-header-base"> <div class="site-logo"> <a title="Quackit Homepage" target="_top" href="/"><img src="/pix/quackit_logo_watermark.png" width="87" height="33" alt="Quackit Logo"></a> </div> <button id="site-nav-toggler" class="site-nav-toggler" aria-expanded="false" aria-controls="site-nav"> <span class="sr-only">Toggle navigation</span> ☰ </button> </div> <nav id="site-nav" class="site-nav"> <div class="site-links"> <ul> <li><a href="/"><i class="fa fa-home"></i> <span class="sr-only">Home</span></a></li> <li><a href="/html/">HTML</a></li> <li><a href="/css/">CSS</a></li> <li><a href="/scripting/">Scripting</a></li> <li><a href="/database/">Database</a></li> </ul> </div> <div class="site-search-top"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:98x0fk-bbgi"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="20" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> </div> </nav> </header> <div class="main"> <article class="content"> <h1 class="page-title">HTML <head> Tag</h1> <div class="ad ad-top"> <!-- GAM 71161633/QCKIT_quackit/article_header --> <div data-fuse="23059883623"></div> </div> <p class="lead">The HTML <code><head></code> tag represents the head section of the HTML document.</p> <p>The <code><head></code> element can contain other HTML tags that contain metadata. Metadata provides information about the document such as title, description, keywords etc. A typical HTML document might contain a <a href="/html/tags/html_title_tag.cfm"><code><title></code></a> tag, one or more <a href="/html/tags/html_meta_tag.cfm"><code><meta></code></a> tags, a <a href="/html/tags/html_script_tag.cfm"><code><script></code></a> tag, and a <a href="/html/tags/html_style_tag.cfm"><code><style></code></a> tag - all enclosed within the <code><head></code> element.</p> <p>Most metadata are not displayed in the browser (although the title usually appears in the browser's title bar) but it can be useful for the functionality of the page. </p> <div class="ad"> <!-- GAM 71161633/QCKIT_quackit/article_incontent_1 --> <div data-fuse="23059883629"></div> </div> <h2>Syntax</h2> <p>The <code><head></code> tag is written as <code><head></code><code></head></code> with the metadata content enclosed between the start and end tags. The <code><head></code> tag is placed between the opening and closing <a href="/html/tags/html_html_tag.cfm"><code><html></code></a> tags.</p> <p>Most HTML documents must have a <a href="/html/tags/html_title_tag.cfm"><code><title></code></a> tag within the <code><head></code> tag (the only exceptions are: if the document is an <a href="/html/tags/html_iframe_tag.cfm"><code><iframe></code></a> <code>srcdoc</code> document or if title information is available from a higher-level protocol, for example in the case of an HTML formatted email).</p> <p>Like this:</p> <script src="/common/js/codemirror/lib/codemirror.js"></script> <script src="/common/js/codemirror/mode/htmlmixed/htmlmixed.js"></script> <script src="/common/js/codemirror/mode/css/css.js"></script> <script src="/common/js/codemirror/mode/javascript/javascript.js"></script> <script src="/common/js/codemirror/mode/xml/xml.js"></script> <div class="code-only"> <textarea id="example1" autocomplete="off" spellcheck="false"><!doctype html>
<html>
<head>
	<title>Page title...</title>
</head>
<body>
	Page body...
</body>
</html></textarea> </div> <script> var exampleCode1 = CodeMirror.fromTextArea(document.getElementById("example1"), { mode: "htmlmixed", tabMode: "indent", styleActiveLine: false, lineNumbers: false, lineWrapping: true, theme: "q-dark" }); </script> <h2>Attributes</h2> <p><a href="/html/tutorial/html_attributes.cfm">Attributes</a> can be added to an HTML element to provide more information about how the element should appear or behave.</p> <p>The <code><head></code> element accepts the following attributes.</p> <table class="tabular"> <tr> <th>Attribute</th><th>Description</th> </tr> <tr> <td>None</td><td> </td> </tr> </table> <h3>Global Attributes</h3> <p>The following attributes are standard across all HTML elements. Therefore, you can use these attributes with the <code><head></code> tag , as well as with all other HTML tags.</p> <ul class="col-3"> <li><code>accesskey</code></li> <li><code>autocapitalize</code></li> <li><code>class</code></li> <li><code>contenteditable</code></li> <li><code>data-*</code></li> <li><code>dir</code></li> <li><code>draggable</code></li> <li><code>hidden</code></li> <li><code>id</code></li> <li><code>inputmode</code></li> <li><code>is</code></li> <li><code>itemid</code></li> <li><code>itemprop</code></li> <li><code>itemref</code></li> <li><code>itemscope</code></li> <li><code>itemtype</code></li> <li><code>lang</code></li> <li><code>part</code></li> <li><code>slot</code></li> <li><code>spellcheck</code></li> <li><code>style</code></li> <li><code>tabindex</code></li> <li><code>title</code></li> <li><code>translate</code></li> </ul> <p>For a full explanation of these attributes, see <a href="/html/tags/html_5_global_attributes.cfm">HTML 5 global attributes</a>.</p> <h3>Event Handlers</h3> <p>Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.</p> <ul class="col-3"> <li><code>onabort</code></li> <li><code>onauxclick</code></li> <li><code>onblur</code></li> <li><code>oncancel</code></li> <li><code>oncanplay</code></li> <li><code>oncanplaythrough</code></li> <li><code>onchange</code></li> <li><code>onclick</code></li> <li><code>onclose</code></li> <li><code>oncontextmenu</code></li> <li><code>oncopy</code></li> <li><code>oncuechange</code></li> <li><code>oncut</code></li> <li><code>ondblclick</code></li> <li><code>ondrag</code></li> <li><code>ondragend</code></li> <li><code>ondragenter</code></li> <li><code>ondragexit</code></li> <li><code>ondragleave</code></li> <li><code>ondragover</code></li> <li><code>ondragstart</code></li> <li><code>ondrop</code></li> <li><code>ondurationchange</code></li> <li><code>onemptied</code></li> <li><code>onended</code></li> <li><code>onerror</code></li> <li><code>onfocus</code></li> <li><code>onformdata</code></li> <li><code>oninput</code></li> <li><code>oninvalid</code></li> <li><code>onkeydown</code></li> <li><code>onkeypress</code></li> <li><code>onkeyup</code></li> <li><code>onlanguagechange</code></li> <li><code>onload</code></li> <li><code>onloadeddata</code></li> <li><code>onloadedmetadata</code></li> <li><code>onloadstart</code></li> <li><code>onmousedown</code></li> <li><code>onmouseenter</code></li> <li><code>onmouseleave</code></li> <li><code>onmousemove</code></li> <li><code>onmouseout</code></li> <li><code>onmouseover</code></li> <li><code>onmouseup</code></li> <li><code>onpaste</code></li> <li><code>onpause</code></li> <li><code>onplay</code></li> <li><code>onplaying</code></li> <li><code>onprogress</code></li> <li><code>onratechange</code></li> <li><code>onreset</code></li> <li><code>onresize</code></li> <li><code>onscroll</code></li> <li><code>onsecuritypolicyviolation</code></li> <li><code>onseeked</code></li> <li><code>onseeking</code></li> <li><code>onselect</code></li> <li><code>onslotchange</code></li> <li><code>onstalled</code></li> <li><code>onsubmit</code></li> <li><code>onsuspend</code></li> <li><code>ontimeupdate</code></li> <li><code>ontoggle</code></li> <li><code>onvolumechange</code></li> <li><code>onwaiting</code></li> <li><code>onwheel</code></li> </ul> <p>Most event handler content attributes can be used on all HTML elements, but some event handlers have specific rules around when they can be used and which elements they are applicable to.</p> <p>For more detail, see <a href="/html/tags/html_5_event_handler_content_attributes.cfm">HTML event handler content attributes</a>.</p> </article> <div class="sidebar"> <nav> <ul> <li> <h3><a href="/html/tags/">HTML Tags</a></h3> <ul class="taglist"> <li><a href="/html/tags/html_comments_tag.cfm">!--...--</a></li> <li><a href="/html/tags/html_doctype_tag.cfm">!DOCTYPE</a></li> <li><a href="/html/tags/html_a_tag.cfm">a</a></li> <li><a href="/html/tags/html_abbr_tag.cfm">abbr</a></li> <li><a href="/html/tags/html_address_tag.cfm">address</a></li> <li><a href="/html/tags/html_area_tag.cfm">area</a></li> <li class="new"><a href="/html/tags/html_article_tag.cfm">article</a></li> <li class="new"><a href="/html/tags/html_aside_tag.cfm">aside</a></li> <li class="new"><a href="/html/tags/html_audio_tag.cfm">audio</a></li> <li><a href="/html/tags/html_b_tag.cfm">b</a></li> <li><a href="/html/tags/html_base_tag.cfm">base</a></li> <li class="new"><a href="/html/tags/html_bdi_tag.cfm">bdi</a></li> <li><a href="/html/tags/html_bdo_tag.cfm">bdo</a></li> <li><a href="/html/tags/html_blockquote_tag.cfm">blockquote</a></li> <li><a href="/html/tags/html_body_tag.cfm">body</a></li> <li><a href="/html/tags/html_br_tag.cfm">br</a></li> <li><a href="/html/tags/html_button_tag.cfm">button</a></li> <li class="new"><a href="/html/tags/html_canvas_tag.cfm">canvas</a></li> <li><a href="/html/tags/html_caption_tag.cfm">caption</a></li> <li><a href="/html/tags/html_cite_tag.cfm">cite</a></li> <li><a href="/html/tags/html_code_tag.cfm">code</a></li> <li><a href="/html/tags/html_col_tag.cfm">col</a></li> <li><a href="/html/tags/html_colgroup_tag.cfm">colgroup</a></li> <li class="new"><a href="/html/tags/html_data_tag.cfm">data</a></li> <li class="new"><a href="/html/tags/html_datalist_tag.cfm">datalist</a></li> <li><a href="/html/tags/html_dd_tag.cfm">dd</a></li> <li><a href="/html/tags/html_del_tag.cfm">del</a></li> <li class="new"><a href="/html/tags/html_details_tag.cfm">details</a></li> <li><a href="/html/tags/html_dfn_tag.cfm">dfn</a></li> <li class="new"><a href="/html/tags/html_dialog_tag.cfm">dialog</a></li> <li><a href="/html/tags/html_div_tag.cfm">div</a></li> <li><a href="/html/tags/html_dl_tag.cfm">dl</a></li> <li><a href="/html/tags/html_dt_tag.cfm">dt</a></li> <li><a href="/html/tags/html_em_tag.cfm">em</a></li> <li><a href="/html/tags/html_embed_tag.cfm">embed</a></li> <li><a href="/html/tags/html_fieldset_tag.cfm">fieldset</a></li> <li class="new"><a href="/html/tags/html_figcaption_tag.cfm">figcaption</a></li> <li class="new"><a href="/html/tags/html_figure_tag.cfm">figure</a></li> <li class="new"><a href="/html/tags/html_footer_tag.cfm">footer</a></li> <li><a href="/html/tags/html_form_tag.cfm">form</a></li> <li><a href="/html/tags/html_h1_tag.cfm">h1</a></li> <li><a href="/html/tags/html_h2_tag.cfm">h2</a></li> <li><a href="/html/tags/html_h3_tag.cfm">h3</a></li> <li><a href="/html/tags/html_h4_tag.cfm">h4</a></li> <li><a href="/html/tags/html_h5_tag.cfm">h5</a></li> <li><a href="/html/tags/html_h6_tag.cfm">h6</a></li> <li><a href="/html/tags/html_head_tag.cfm">head</a></li> <li class="new"><a href="/html/tags/html_header_tag.cfm">header</a></li> <li class="new"><a href="/html/tags/html_hgroup_tag.cfm">hgroup</a></li> <li><a href="/html/tags/html_hr_tag.cfm">hr</a></li> <li><a href="/html/tags/html_html_tag.cfm">html</a></li> <li><a href="/html/tags/html_i_tag.cfm">i</a></li> <li><a href="/html/tags/html_iframe_tag.cfm">iframe</a></li> <li><a href="/html/tags/html_img_tag.cfm">img</a></li> <li><a href="/html/tags/html_input_tag.cfm">input</a></li> <li><a href="/html/tags/html_ins_tag.cfm">ins</a></li> <li><a href="/html/tags/html_kbd_tag.cfm">kbd</a></li> <li><a href="/html/tags/html_label_tag.cfm">label</a></li> <li><a href="/html/tags/html_legend_tag.cfm">legend</a></li> <li><a href="/html/tags/html_li_tag.cfm">li</a></li> <li><a href="/html/tags/html_link_tag.cfm">link</a></li> <li class="new"><a href="/html/tags/html_main_tag.cfm">main</a></li> <li><a href="/html/tags/html_map_tag.cfm">map</a></li> <li class="new"><a href="/html/tags/html_mark_tag.cfm">mark</a></li> <li><a href="/html/tags/html_menu_tag.cfm">menu</a></li> <li><a href="/html/tags/html_meta_tag.cfm">meta</a></li> <li class="new"><a href="/html/tags/html_meter_tag.cfm">meter</a></li> <li class="new"><a href="/html/tags/html_nav_tag.cfm">nav</a></li> <li><a href="/html/tags/html_noscript_tag.cfm">noscript</a></li> <li><a href="/html/tags/html_object_tag.cfm">object</a></li> <li><a href="/html/tags/html_ol_tag.cfm">ol</a></li> <li><a href="/html/tags/html_optgroup_tag.cfm">optgroup</a></li> <li><a href="/html/tags/html_option_tag.cfm">option</a></li> <li class="new"><a href="/html/tags/html_output_tag.cfm">output</a></li> <li><a href="/html/tags/html_p_tag.cfm">p</a></li> <li><a href="/html/tags/html_param_tag.cfm">param</a></li> <li><a href="/html/tags/html_picture_tag.cfm">picture</a></li> <li><a href="/html/tags/html_pre_tag.cfm">pre</a></li> <li class="new"><a href="/html/tags/html_progress_tag.cfm">progress</a></li> <li><a href="/html/tags/html_q_tag.cfm">q</a></li> <li class="new"><a href="/html/tags/html_rb_tag.cfm">rb</a></li> <li class="new"><a href="/html/tags/html_rp_tag.cfm">rp</a></li> <li class="new"><a href="/html/tags/html_rt_tag.cfm">rt</a></li> <li class="new"><a href="/html/tags/html_rtc_tag.cfm">rtc</a></li> <li class="new"><a href="/html/tags/html_ruby_tag.cfm">ruby</a></li> <li><a href="/html/tags/html_s_tag.cfm">s</a></li> <li><a href="/html/tags/html_samp_tag.cfm">samp</a></li> <li><a href="/html/tags/html_script_tag.cfm">script</a></li> <li class="new"><a href="/html/tags/html_section_tag.cfm">section</a></li> <li><a href="/html/tags/html_select_tag.cfm">select</a></li> <li><a href="/html/tags/html_slot_tag.cfm">slot</a></li> <li><a href="/html/tags/html_small_tag.cfm">small</a></li> <li class="new"><a href="/html/tags/html_source_tag.cfm">source</a></li> <li><a href="/html/tags/html_span_tag.cfm">span</a></li> <li><a href="/html/tags/html_strong_tag.cfm">strong</a></li> <li><a href="/html/tags/html_style_tag.cfm">style</a></li> <li><a href="/html/tags/html_sub_tag.cfm">sub</a></li> <li class="new"><a href="/html/tags/html_summary_tag.cfm">summary</a></li> <li><a href="/html/tags/html_sup_tag.cfm">sup</a></li> <li><a href="/html/tags/html_table_tag.cfm">table</a></li> <li><a href="/html/tags/html_tbody_tag.cfm">tbody</a></li> <li><a href="/html/tags/html_td_tag.cfm">td</a></li> <li class="new"><a href="/html/tags/html_template_tag.cfm">template</a></li> <li><a href="/html/tags/html_textarea_tag.cfm">textarea</a></li> <li><a href="/html/tags/html_tfoot_tag.cfm">tfoot</a></li> <li><a href="/html/tags/html_th_tag.cfm">th</a></li> <li><a href="/html/tags/html_thead_tag.cfm">thead</a></li> <li class="new"><a href="/html/tags/html_time_tag.cfm">time</a></li> <li><a href="/html/tags/html_title_tag.cfm">title</a></li> <li><a href="/html/tags/html_tr_tag.cfm">tr</a></li> <li class="new"><a href="/html/tags/html_track_tag.cfm">track</a></li> <li><a href="/html/tags/html_u_tag.cfm">u</a></li> <li><a href="/html/tags/html_ul_tag.cfm">ul</a></li> <li><a href="/html/tags/html_var_tag.cfm">var</a></li> <li class="new"><a href="/html/tags/html_video_tag.cfm">video</a></li> <li class="new"><a href="/html/tags/html_wbr_tag.cfm">wbr</a></li> <li><a href="/html/tags/html_5_global_attributes.cfm">HTML5 Global Attributes</a></li> <li><a href="/html/tags/html_5_event_handler_content_attributes.cfm">HTML5 Events</a></li> </ul> </li> <li> <h3><a href="/html/">HTML Reference</a></h3> <ul> <li><a href="/html/tags/" title="Alphabetical list of all HTML tags">HTML Tags</a></li> <li><a href="/html/codes/" title="">HTML Codes</a></li> <li><a href="/html/templates/" title="">HTML Templates</a></li> <li><a href="/html/html_editors/">HTML Editors</a></li> <li><a href="/html/tutorial/" title="">HTML Tutorial</a></li> <li><a href="/create-a-website/" title="">Create a Website</a></li> <li><a href="/character_sets/">Character Set Reference</a></li> </ul> </li> </ul> </nav> <div class="ad ad-left"> <!-- GAM 71161633/QCKIT_quackit/article_vrec_2 --> <div data-fuse="23059511712"></div> </div> </div> <div class="ads"> <div class="ad ad-right"> <!-- GAM 71161633/QCKIT_quackit/article_vrec_1 --> <div data-fuse="23059883626"></div> </div> </div> </div> <div class="searchbox-bottom"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:npmuvy-i8kk"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="30" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> <script src="//cse.google.com/cse/brand?form=cse-search-box-bottom&lang=en"></script> </div> <footer> <p class="about"><a href="/"><i class="fa fa-home"></i> Home</a> | <a href="/about.cfm" rel="nofollow">About</a> | <a href="/contact.cfm" rel="nofollow">Contact</a> | <a href="/terms_of_use.cfm" rel="nofollow">Terms of Use</a> | <a href="/privacy_policy.cfm" rel="nofollow">Privacy Policy</a></p> <p>© Copyright 2000 - 2024 Quackit.com </p> </footer> <script src="/common/js/spectrum/spectrum.js"></script> <script src="/common/js/lightbox2-master/dist/js/lightbox.min.js" charset="utf-8"></script> <script> $(document).ready(function(){ $( "#site-nav-toggler" ).click(function() { $( "#site-nav" ).toggle( "slow" ); }); }); </script> <script> $(function(){var a=window.location.href;$(".sidebar nav a").each(function(){a==this.href&&$(this).closest("li").addClass("selected")})}); </script> </body> </html>