Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6216407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:14:43+00:00 2026-05-24T07:14:43+00:00

In HTML 4 and XHTML 1, you can’t assign a class to the <head>

  • 0

In HTML 4 and XHTML 1, you can’t assign a class to the <head> element. However, in XHTML 1.0 you can give it an ID.  In HTML5 it seems you can give it a class.  I am curious, why you would want to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:14:43+00:00Added an answer on May 24, 2026 at 7:14 am

    class is one of what are now called global attributes (along with global events). They’ll have to apply to every single element in the DOM, regardless of its nature.

    I believe it’s related to the API. The spec defines every DOM HTML element to inherit from a base interface called HTMLElement that defines the aforementioned global attributes and events. Namely:

    interface HTMLElement : Element {
    
      // ...
    
      // metadata attributes
               attribute DOMString id;
               attribute DOMString title;
               attribute DOMString lang;
               attribute DOMString dir;
               attribute DOMString className;
      readonly attribute DOMTokenList classList;
      readonly attribute DOMStringMap dataset;
    

    With that said, the editor(s) of the spec did make the following note at the end of the list of global attributes/events:

    Note: While these attributes apply to all elements, they are not useful on all elements. For example, only media elements will ever receive a volumechange event fired by the user agent.

    So I suppose they don’t expect you to, but they can neither think of a reason to allow it or not to allow it. It’s just part of the API (i.e. an HTMLHeadElement is an HTMLElement anyway).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which HTML tags can use the class attribute? (In which standards — e.g. HTML/XHTML/HTML5
If I want to show: <html xmlns=http://www.w3.org/1999/xhtml> tags in HTML, how can I register
In how many ways we can give color info in X/HTML, css? I know
In the W3C working draft for HTML5 here's a line I find confusing: http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml
Can I use CSS3 properties with XHTML, or only with HTML5 web pages? Is
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Youtube embed test</title>
My code as follow: <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta http-equiv=content-type content=text/html; charset=UTF-8> <title>Demo</title> <style type=text/css>
How can I make the code indent correctly? app/views/layouts/shared.html.haml: = render :partial => shared/head
I know that CSS can be used to control the presentation of (X)HTML in
Is there a decent way with static HTML/XHTML to create common header/footer files to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.