Note that there are some explanatory texts on larger screens.

plurals
  1. POIn HTML, should block level elements always wrap <a> tags?
    primarykey
    data
    text
    <p>In HTML, should block level elements always wrap <code>&lt;a&gt;</code> 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</p> <pre><code>&lt;h3&gt;&lt;a href="/"&gt;Your Header&lt;/a&gt;&lt;/h3&gt; </code></pre> <p>be this</p> <pre><code>&lt;a href="/"&gt;&lt;h3&gt;Your Header&lt;/h3&gt;&lt;/a&gt; </code></pre> <p>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.</p> <p>And yes I have read this question <a href="https://stackoverflow.com/questions/5080261/in-html-which-way-round-should-a-and-h1-be-nested">In HTML which way round should a and h1 be nested?</a> but I'm not sure if a different or more flexible rule applies for <code>&lt;h3&gt;</code> tags.</p> <p>Taking in the comments below and looking again at the code, I have two possible solutions:</p> <ol> <li>Wrap the <code>&lt;h3&gt;</code> elements with <code>&lt;a&gt;</code> elements (ok in HTML5)</li> <li>Add <code>.class a</code> to the CSS so that it inherits parent <code>div</code> styles as follows: </li> </ol> <p>HTML</p> <pre><code>&lt;div class="class"&gt; &lt;h3&gt;&lt;a href="/"&gt;Your Header&lt;/a&gt;&lt;/h3&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>.class, .class a { width:296px; height:46px; overflow:hidden; color:#FE5815; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload