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 8221117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:47:24+00:00 2026-06-07T13:47:24+00:00

In HTML, should block level elements always wrap <a> tags? What if it’s necessary

  • 0

In HTML, should block level elements always wrap <a> tags? What if it’s necessary for the tag to wrap the block level element to ensure the correct styles are applied? For example can this

<h3><a href="/">Your Header</a></h3>

be this

<a href="/"><h3>Your Header</h3></a>

NB: I’m going for the latter approach to ensure the correct styles are applied (I’m working with legacy code that is just not worth re-working for this one element), but while doing this I was interested to know what the community’s views are.

And yes I have read this question In HTML which way round should a and h1 be nested? but I’m not sure if a different or more flexible rule applies for <h3> tags.

Taking in the comments below and looking again at the code, I have two possible solutions:

  1. Wrap the <h3> elements with <a> elements (ok in HTML5)
  2. Add .class a to the CSS so that it inherits parent div styles as follows:

HTML

<div class="class">
    <h3><a href="/">Your Header</a></h3>
</div>

CSS

.class, .class a {
    width:296px;
    height:46px;
    overflow:hidden;
    color:#FE5815;
}
  • 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-06-07T13:47:29+00:00Added an answer on June 7, 2026 at 1:47 pm

    In this context, it is absolutely allowed for the a element to contain the h3 element, at least according to HTML5.

    An a element is known as a “transparent” element: it may contain whatever its parent element may contain. The only criterion is that it may not contain any other “interactive” content, e.g. other a elements, button elements, iframe elements. In this case, presuming that the first version is allowed, the second version is also allowed under HTML5.

    This is the page in the HTML5 spec that specifies this. It takes a little interpretation to understand, unfortunately…

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

Sidebar

Related Questions

I know that I should put all the html elements in body tag, but
I have often wrapped block level elements with <a> tags in order to make
I am using the HTML button tag but the style mentioned below should only
Within a standard code block, should HTML appear exactly as written? For example, if
I'm trying to put some (vertically-stacked) display:block elements within a display:inline-block element. According to
html() should be used for setting content in non-form elements such as div's. **
Wondering if I should ALWAYS use the respond_to/format.xxx block in ALL of my actions
Html text box should have same font size for both upper and lower case
My app should render html, to answer when a user clicks ajax-link. My controller:
what basic tips should we observe in design web pages(html/css/javascript) for having highest compatibility

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.