I've been looking around SO and Google for a way to link to certain parts of an SO question or answer. For instance adding to the top of your question/answer links to header tags that are further down the page, via the
name attributes. For instance here is an example of linking to one answer to a Super User question via the
name attribute of the
a tag and the
id attribute of the
This is a name tag and div tag found in the source of one of the questions asked on Super User. <a name="337941"></a> <div id="answer-337941" class="answer" data-answerid="337941"></div> This links to an answer to the question asked on Super User by use of the name attribute. <a href="https://superuser.com/questions/337853/britannica-on-linux#337941">Link</a> This links to the same answer by use of the id attribute. <a href="https://superuser.com/questions/337853/britannica-on-linux#answer-337941">Link</a>
[SO] only supports a very strict subset of HTML! and the only tags which are allowed attributes are the
<a> tags and neither one allows
title attribute is a global attribute in HTML5 that just shows a description when hovered over.
Basically I'm seeing if there is a way to do the following:
Assume this is my answer to a question on SO, and the link to the question is
This is my answer. It is very long and contains different sections split up by <h2> tags, but if you don't want to have to scroll through the whole question then just use a link provided below. <a href="http://stackoverflow.com/questions/123/this-is-a-question#S1">Section 1</a> <a href="http://stackoverflow.com/questions/123/this-is-a-question#S2">Section 2</a> ... <a href="http://stackoverflow.com/questions/123/this-is-a-question#S4">Section 8</a> <h2 id="S1">Section 1</h2> ... section 1 blah <h2 id="S2">Section 2</h2> ... blah ... ... blah blah blah ... <h2 id="S8">Section 8</h2>
I'm sorry if this has been asked before, I searched Google and SO thoroughly, but maybe I didn't search for the right thing.