37

In HTML, if a full sentence is used for a link, should its terminal punctuation (i.e., period) be included in the linked text?

Consider these two examples:

<a href="about:blank">Watch the video on YouTube</a>.

<a href="about:blank">Watch the video on YouTube.</a>

Is this just a matter of personal preference, or is one of these more readable than the other?


Edit:

It seems that there's some confusion - and certainly a valid related discussion - about including an actual URL (in part or whole) within the link text.

Consider the following:

<a href="...">Watch the video here.</a>
<a href="...">Watch the video on YouTube.</a>
<a href="...">Watch the video on youtube.com.</a>

I think most would agree that including the period in the third example is bad practice; it creates multi-period confusion with respect to the ".com" in the link text.

For purposes of this question, I'm specifically wondering about the former two examples that do not include ".com" in the link text. (Although one might make a convincing argument that using "YouTube" without the ".com" is still problematic by proxy. If so, let's assume I'm asking about only the first example: "Watch the video here.")

6

12 Answers 12

25

I would answer no, the terminal punctuation should not be included in the hyperlink. It is the text that is being hyperlinked rather than the construct that the text is a part of.

Consider other such constructs: in an unordered list you wouldn't include the bullet point in a hyperlink, in an ordered list you wouldn't include the number, and in a comma-separated list of hyperlinks you wouldn't include the commas inside any of the hyperlinks.

Interestingly Stack Exchange is inconsistent in this usage. "1 new answer has been posted - load new answers." includes the period in the hyperlink whereas "To learn more, see our tips on writing great answers." doesn't.

I much prefer the latter.

4
  • 3
    You make a good argument, but throw it away and draw a different conclusion. In your final example, the period is part of the construct (a complete sentence) containing the linked text. In the preceding example, the entire sentence is linked -- the period is not part of the containing construct, it is part of the linked text itself.
    – Ben Voigt
    Feb 15, 2012 at 21:43
  • 1
    As an aside, a bullet-pointed list of links probably would be more useful if the bullet points where clickable!
    – aslum
    Feb 16, 2012 at 2:18
  • 1
    I think a better comparison than bullets would be commas. When linking an item in a comma-separated list, you typically exclude the comma. However, when you're linking a phrase that happens to include a comma, you include it. I would apply the principles to terminating punctuations, i.e. periods, question marks and exclamation points. [What is user experience?] vs. what is [user experience]? Feb 17, 2012 at 0:18
  • The comparison to bullet points is not helpful, because they are not a part of the sentence. The comma-separated list is only relevant if your claim is that periods are merely sentence separators and do not belong to any particular sentence. But in that case why does a lone sentence still get a period? Why does a period occur at the end of the final sentence? If "it is the text that is being hyperlinked" and you consider punctuation to not be text, then do you exclude punctuation that is between alphabetic characters in the text? I don't see any valid reason here to exclude the period.
    – iconoclast
    Mar 9, 2022 at 22:30
20

Don't link the period.

Google: No Links for Punctuation
If you include a URL in a Gmail messages, Google automatically links the URL. They do not include terminal periods adjacent to links, nor any other punctuation for that matter. So, full sentence links would still not link the period. Gmail Link Punctuation

Developer Interview: Alex Hunter Trujillo
I asked one of the developers here his opinion on linking terminal periods. After making a sucking sound halfway between a gasp and a hiss, he had this to say:

When a programmer is making code, it needs to be in a way that meets their expectations of syntax. Always, the terminal punctuation is outside of the tag. … It's just good "code grammar."

If it's a whole paragraph getting linked, yes, include the final period in the link. But for a single sentence, don't include the period; it looks awful.

However, Titles are a different matter.

You may be wondering, "what about linked titles that are sentences?" Titles are whole different matter. If you link a title, link the whole title, no exceptions. That's because it's a title, not because it's a sentence.

Further Evidence…

The Yahoo Style Guide (1st ed., p. 221) has this to say:

Use a period (or other ending punctuation) at the end of any link that is a complete sentence, including very short imperative sentences. But don't link the period.

Southern Utah University has this to say about URLs in their style guide:

If a URL ends a sentence, put a period after it, but ensure the period is not included as part of the hyperlink in electronic publications.

Still looks funny? Rewrite using anchor text, and set off links.

Rewrite your sentences so that the link is only a part of the sentence, and avoid ending with a URL. And also be sure to make your anchor text as useful as possible. Here are some examples:

Set Anchor Text Off From Sentence
Now isn't this much clearer?

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Watch the video on YouTube:

Star Wars according to a 3 year old

At Least Use Better Anchor Text
It's not just about linking a sentence. Not only is this easier to read, it's easier to understand. (Yes, that period after understand is italic, but the period after YouTube is not in the link.)

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Watch the video on YouTube: Star Wars according to a 3 year old.

If You Must: Sentence Link Inside a Paragraph
Do you really want to hyperlink an entire sentence? You do? Well, fine, just go with option 3.

Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Nulla vitae elit libero, a pharetra augue. Watch the video on YouTube: Star Wars according to a 3 year old. Cras mattis consectetur purus sit amet fermentum.

12
  • Out of curiosity, in option 3, why do you feel the period after the word "understand" should be included in the italics tag?
    – Michael
    Jul 2, 2012 at 16:05
  • 2
    @michael Chicago Manual of Style, section 5.4–5.6 "Typographic Considerations": The style is for punctuation to follow the formatting of the character immediately preceding it, unless the italicization (or other formatting) is relevant strictly to that phrase and not the punctuation. So, "When did she write Together Again?" but "After she wrote What Next?".
    – Taj Moore
    Jul 2, 2012 at 17:13
  • 1
    Thanks for the response! That's interesting. What if we apply that same logic to my original question about whether the punctuation belongs inside the link tag? Do you that same Chicago Manual of Style rule applies?
    – Michael
    Jul 2, 2012 at 18:42
  • My edition of the CMOS is from 1993, so no reference to hyperlinks. I don't think of hyperlinks as quite the same as typographical formatting. If anything, the underline has been co-opted into denoting a hyperlink, and no longer stands on its own in web text.
    – Taj Moore
    Jul 2, 2012 at 19:08
  • @Michael, I reworked the answer to include authoritative references.
    – Taj Moore
    Jul 2, 2012 at 19:43
14

Just a user's perspective with no supporting research here:

If the link is a complete sentence -- that is, I'm not talking about "nested" sentences like quotes but rather full, stand-alone sentences -- then as a user I expect to see the punctuation as part of the link. The sentence is a unit; breaking it up with a </a> triggers my built-in proofreader the same way a punctuation error involving parentheses does. (For example, some people would put the period at the end of this sentence outside of the close paren, which feels weird.) Errors of this sort pull me out of the content for just a moment, which is disruptive.

If, on the other hand, the link is a phrase, I expect it to not include the punctuation. For example, if "on the other hand" in the previous sentence were a link, neither comma belongs inside the anchor.

3
  • 1
    "outside of the close paren, which feels weird" -- I'm afraid weird is going to be the new norm in this regard.
    – Kris
    Feb 16, 2012 at 10:46
  • 6
    @Kris, to clarify, IMO the period does belong outside of the paren if it ends the outer sentence (like this). Lots of people think that's weird, but I think putting it inside is weird (that's not a sentence in there!). So "weird" is probably pretty subjective. Whee. :-) Feb 16, 2012 at 15:42
  • best answer by far
    – iconoclast
    Mar 10, 2022 at 3:01
11

I think it depends more on what elements/content the link is wrapping. In HTML5 <a> elements use a transparent content model, which means they can wrap a <p> element. Obviously, you'd include the punctuation if you're linking the entire paragraph in HTML5:

<a...>
  <p>Lorem ipsum dolor sit amet.</p>
</p>

But in HTML4 where this would be invalid, you'd swap the order of the elements (or use invalid HTML):

<p>
  <a...>Lorem ipsum dolor sit amet.</a> <!-- note the punctuation on the inside -->
</p>

Within a paragraph you'd have to determine what content is being linked.

My take on the semantics would be that stand-alone sentences would not include punctuation, whereas multiple sentences would.

Here quotation and byline all belong within the link, so it makes sense to include punctuation.
<p>
  ...lorem ipsum...
  <a...>Foo said <q>Lorem ipsum dolor sit amet.</q></a>
  ...dolor sit amet...
</p>
Here the quotation is linked, including the punctuation
<p>
  ...lorem ipsum...
  Foo said <a...><q>Lorem ipsum dolor sit amet.</q></a> <!-- could be <q><a> -->
  ...dolor sit amet...
</p>
Here only the words are linked because the link relates to part of the sentence
<p>
  ...lorem ipsum...
  Foo said <q>Lorem ipsum <a...>dolor sit amet</a>.<q>
  ...dolor sit amet...
</p>

So to answer your question, if your sentence:

Watch this video on YouTube.

Would make sense structured as:

<a...>
  <p>Watch this video on YouTube.</p>
</a>

You'd link the whole thing.

If, instead, it was:

Lorem ipsum dolor sit amet. Watch this video on YouTube. Lorem ipsum dolor sit amet.

I'd structure it as:

<p>
  Lorem ipsum dolor sit amet. <a...>Watch this video on YouTube</a>. Lorem ipsum dolor sit amet.
</p>

And for multiple sentences as:

<p>
  <a...>Lorem ipsum dolor sit amet. Watch this video on YouTube.</a> Lorem ipsum dolor sit amet.
</p>
2
  • 5
    +1 for considering the HTML5 implementation of hyperlinks
    – Rahul
    Feb 16, 2012 at 1:09
  • It seems a bit arbitrary to switch back and forth like that (if linking one sentence, exclude it; if linking more than one, include it; but also include it if the single sentence is its own paragraph or if the sentence is a quote). I can see no pattern to these rules, semantic or otherwise. There is, however, a usability argument for always excluding the final period--it ensures that adjacent links are easily distinguishable. Feb 17, 2012 at 0:31
6

It’s not a big issue, since the practical impact is very small. On logical grounds, it is better to include the sentence-termination punctuation, as it indicates that the sentence is complete. This can be useful, for example, when the user uses a browser-generated list of all links on a page (possible when using some assistive software or plug-in).

Typographical considerations point to the same different direction. Many typographers think that a punctuation character that immediately follows a word should appear in the same style as the word, e.g. in italic if the word is italic. For links, this means that the punctuation character should be in a link color and underlined (or follow whatever other styles are used for links). From a typographic point of view, this should also apply when the punctuation character is not logically part of the link text but e.g. a comma, or a period after a single word at the end of a sentence.

2

I'd suggest it's a bad practice, especially if the URL is at the end of the sentence as in the example above.

<a href="#">Do your taxes at Irs.gov.</a>

This could pose problems if someone C&Ped the URL rather then clicking your link. Admittedly there is still the possibility of copying the period if it's outside the link, but the less tech savvy are less likely to think that period is part of URL.

If you feel strongly about including the period in the link, you will want to change your order a bit, such as:

<a href="#">Visit YouTube to watch the video.</a>
4
  • 2
    A period following a URL is equally problematic with or without a link present.
    – Ben Voigt
    Feb 15, 2012 at 21:45
  • If it wouldn't make the Grammar Nazis gnash their teeth and spout fire and brimstone, I'd suggest putting a space between a terminal URL and the final punctuation of the sentence in which it occurs. Or again, just re-arrange the sentence so the URL is not terminal.
    – aslum
    Feb 16, 2012 at 2:16
  • In the question's example, the link's text is not a URL; the link text is plain English language, e.g., "Watch the video here." There's no "youtube.com" URL to create multi-period confusion.
    – Michael
    Feb 16, 2012 at 22:29
  • True, but when mentioning a website that isn't a .COM address, the TLD is usually included in the name. Many website's names are branded w/ the TLD in the name even when it is COM... Amazon.com is a prime example, but you can surely think of more without much trouble.
    – aslum
    Feb 17, 2012 at 4:10
2

We can argue about the philosophy as long as we like, but the practical side is that terminating the text of a Url with a period just breaks its utility.

The period is a valid URL character so only a true natural language parser (like a human) is going to correctly decide if it is in or out of the URL entity. All browsers and email clients I have tried include the period as part of the link,also double clicking on the text field to copy include the period (for the same reason). however the servers do not have corresponding file names that end in a period so they 404 the request.

2
  • +1 You have a point here worth a revisit and bearing in mind.
    – Kris
    Feb 16, 2012 at 10:51
  • 2
    In the question's example, the link's text is not a URL; the link text is plain English language, e.g., "Watch the video here." There's no "youtube.com" URL to create multi-period confusion.
    – Michael
    Feb 16, 2012 at 22:28
1

You got some good answers here and I agree with what most people have said about having the full stop inside the link as having it outside the link (and the full stop being a different color unless your text has the same color as your links),it is a sudden transition in color and as one answer pointed out,it is kind of jarring for someone who is fussy about grammer. However there are exceptions to the rule such as when you'r link text might be ending with a a website address eg:

<a href="http://www.google.com">My favorite search engine is **www.google.com.** </a> 

Though most users might just click on the link ,some people might want to copy the address for reference and the . becomes an unwelcome addition.

Similarly for emails.

<a href="mailto:[email protected]">Send me an email at [email protected].</a> ,if a person does not have an email client set up in his system and chooses to copy the email ,then he might possibly copy the email with the fullstop at the end

1

Starting with your examples: (See better examples at end.)

If the link doesn't contain the contents of the entire sentence e.g.

Watch the video here.
Watch the video on YouTube.
Watch the video on youtube.com.

... then it makes sense not to include the stop, since it isn't relevant to the link's text.

If the link contains the contents of the entire sentence e.g.

Watch the video here.
Watch the video on YouTube.
Watch the video on youtube.com.

... then it makes sense to include the stop so that the last character doesn't have a different style.

If you split the sentence into various links e.g.
(not intended to be good examples)

Watch the video on YouTube.
Watch the video on youtube.com.

... then the first rule applies.

Better examples would be:

For those of you that missed the event, you can watch the video here.
Alternatively, you can watch our video guide here.
You can watch our video guide, read our FAQ or ask on meta.

0

I have two initial thoughts on links. Since we no longer use "click here" (hopfully!), a link is descriptive to where you are going, as well as descriptive for search engines. I don't see that punctuation in this case adds any value to the link, and therefore would not include it. Combined with the answers above, I vote for the DNI path.

0

I tend to exclude the period from the link for visual reasons. I find including the period in the link visually blurs the punctuation of the sentence and thus the clarity of the sentence. It's a small point, but clarity in the primary interface makes the most sense to me.

-1

HTML anchors used to be underlined by default

Consider this simple HTML document:

<html>
<p>Hyperlinks are <a href=".">underlined by default</a>.</p>
<p>Nowadays, this is <a href=".">styled away with CSS,</a> 
which is <a href=".">confusing people over here.</a></p>
</html>

Here is how this HTML document is rendered by default in most web browsers:

anchors+punctuation

Without any CSS, HTML hyperlink anchors are underlined. When the punctuation is included within the anchor, the underline extends to include the period and even to cross any comma. This does not look so nice, hence the historical consensus of not including punctuation within the hyperlink anchor.

This is less an issue with the current trend/fashion of not underlining hyperlinks. However, a user could override this CSS with his/her own local styling in the browser. He/she might do so for reasons of accessibility. Therefore, it is still wise to stick to the historical convention of not including punctuation with anchors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.