I was checking a navbar markup example to use in a website, when I found the attribute "data-unsp-sanitized" placed in HTML anchor tags like this:
<a href="#" data-unsp-sanitized="clean">
I searched over Stack Overflow and Google, and surprisingly ended with no explanations of what this attribute does or why it is there.
It means your anchor tag has been assigned additional information clean. It may be used by CSS or Javascript. More about HTML data-* attributes you can read here.
Related
Experts
I am confused as how to add the following attribute in the anchor links.
What should be the sequence ?
1:
<a href='https://copybloggerthemes.com/' title='Blogger Templates' rel='dofollow' target='_blank'>Copy Blogger Themes</a>
2:
<a href='https://copybloggerthemes.com/' rel='dofollow' title='Blogger Templates' target='_blank'>Copy Blogger Themes</a>
3:
<a href='https://copybloggerthemes.com/' target='_blank' rel='dofollow' title='Blogger Templates'>Copy Blogger Themes</a>
All the above have three attributes target, rel, title, now I am confused which one is the perfect one.
I am confused which one attribute should be right after another ?
Which one is SEO friendly ?
Regarding your HTML question of which order the attributes should be in, it makes absolutely no difference, and all of those versions are 100% equal.
Further, as others have mentioned, there is no such thing as "rel= dofollow", and by default, all links are "follow" links. The only time you should use this attribute is when you want a link to be "no follow". Then you would have rel="nofollow" as an attribute.
So, your anchor tag should look something like this:
<a href='https://copybloggerthemes.com/' title='Blogger Templates' target='_blank'>Copy Blogger Themes</a>
But as I noted, the order of the attributes doesn't matter in the slightest.
As unor said, the SEO Friendliness question is off-topic here.
i made this page yesterday and href links doesn't work...
HTML and CSS source here: https://titanpad.com/jmAHmU3GyI
I may not understand exactly what you're asking, but the href attribute belongs inside an anchor tag, like so:
<td>Link</td>
Specification: http://www.w3schools.com/tags/att_a_href.asp
Demo: http://jsfiddle.net/0mtto06n/
You are using the href attribute on <li> elements which is unfortunatelly not going to work. To create links use Link text
Read more here:
about a tag
So I have a box on the right side of the page which when clicked on different titles will take to different news articles on the page though I also have it so when articles within the website titles are clicked upon on the page that they will be taken to the source. At the moment though neither are working what is going wrong?
html
<a name="Anchor1">News Article</a>
Use id attribute inside the link to have the same effect as name attribute
<a id="Anchor1" href="http://newsarticle.com">News Article</a>
Simply add an id attribute to the link:
<a id="foo" href="http://newsarticle.com">News Article</a>
Then link to it like this:
link to foo
Nested <a> elements are forbidden in HTML syntax.
Browsers effectively enforce this restriction in their parsing rules.
Example:
if you have a link ,
a<a href="b.html">bc</a>
Browsers will parse it as,
a b c
Reference: Nested links are illegal.
The first Google search result for "html links" says (paraphrased) that to create a bookmark / section inside a webpage, we've to do this:
<a id='section-2'>Section 2</a>
so that we can link to it like this:
<a href='page.php#section-2' >Click</a>
But why the site is recommending using anchor tag around "Section 2"? -When it can be done using span:
<span id='section-2'>Section 2</span>
Are there compatibility issues? Because the first search result for "creating bookmarks within a webpage" also says to surround the heading with anchor tag:
<p><a name="title">Title</p>
Though this particular example is incorrect for various other reasons.
I've a supplementary question:
Why to surround the heading with the container when it can be done simply like this:
<span id='section-2'></span>Section 2
Does it matter?
<span id='section-2'>Sec</span>tion 2
<a href='page.php#section-2' >Click</a>
There is no point. W3schools is unreliable, just don’t use it, and you will avoid confusion and wrong information; see http://w3fools.com
In the old days, the only way to set a destination anchor within a page was to use <a name=...>...</a> element (at the text level). Later, the id attribute was added and is now supported by all browsers in use, so you can make any element a destination anchor simply by attaching an id attribute to it. E.g., to make it possible to link to a heading like <h2>Section 2</h3>, you could make it just <h2 id=section-2>Section 2</h2>. No need for an artificial extra element.
Using <span id='section-2'></span>Section 2, though formally correct, is not a good idea. You win nothing by using it, as opposite to the more logical markup. And if you e.g. later want to style (highlight) the element to which the user has “jumped” into with a link, using the :target pseudo-class, you will find yourself in an awkward position: the pseudo-class would let you style just the empty content of the span.
Regarding the question in the title, there is no reason to make the top of a page an destination anchror, with <a id='top'>Top of page</a> or otherwise. First, you can refer to the start of the page using just href=# since by URL specifications, # denotes the start of the current resource. Second, “Back to top” links are basically useless or worse: every browser has a simple command for going to the start of the page, and an explicit “Back to top” link can be confusing: back to top of what?
In the early days of html an anchor element was the only way to do this, but just because you can now do it with other element types doesn't mean you should: using an anchor for this purpose is semantically correct because it makes it clear to anybody reading or maintaining your markup that the element is intended as a navigation target. (Noting that there will often be many elements on the page that have an id but are not navigation targets.)
"Why to surround the heading with the container when it can be done simply like this:
<span id='section-2'></span>Section 2
Because if you put the text of your heading inside an element you can style it and/or easily mess with it from JavaScript. Indeed, if it is a heading you may want to put it in an <h1>, <h2>, etc. tag rather than a <span>.
I have links like this:
<a class="faq_text_header_jump" href="#general_questions">General Questions</a><br>
<a class="faq_text_header_jump" href="#how">How do i..</a><br>
<a class="faq_text_header_jump" href="#once_you_book">Once you've booked lessons..</a>
And a target like so:
<div class="faq_text_section_header" id="how"><h2>How do I...?</h2></div>
But my 2nd and 3rd links don't work.
See an example here: http://lessonshark.com/dev1/homes/faq
HTML has a solution for that.
use
<a name="target">
to mark the position in the page you want to jump to
<a href="page.html#target">
Use the id attribute to specify the destination of the link. This is the recommended practice, though the older <a name=...>...</a> works too, though it is more limited. What you must not do under any circumstances is to specify the destination twice using the same name. Currently the markup has
<a name="how_do_i">
<div class="faq_text_section_header" id="how_do_i" >How do I...?</div></a>
This is invalid as per HTML 4.01 and XHTML 1.0 (though permitted in HTML5 drafts), since an a element must not contain a div element. More seriously, this makes how_do_i doubly defined, which can cause just about anything. Fix this to just
<div class="faq_text_section_header" id="how_do_i" >How do I...?</div>
and make sure that your link uses href="#how_do_i" (as it does now, but the question said otherwise). Consider making that div an h2 (and tune the stylesheet accordingly), since it’s really a heading.
Also note that in the link,
<a class="faq_text_header_jump"href="#how_do_i">How do i..</a>
there should be a space before href. This is just formal syntax, but it is best to get it right so that you can utilize a validator efficiently.
You need a named anchor somewhere in your document.
To create a named anchor, just use HTML like this:
<a name="anynameyoulike"></a>
Then, you can jump back to that point in the page with a link like this one:
Jump to Named Anchor