You’ve even made it a point to make sure your alt text is meaningful.
Very, very awesome.
But there’s something else you need to keep in mind when coding your alt attributes, and that’s making sure you don’t add line breaks when coding.
Why does it matter whether or not I add line breaks?
It matters for a couple of reasons. First, with a screen reader, the reading of alt text stops at the end of the line. When you resume reading, the object role (in this case “graphic”) is announced at the start of each new line.
If you’d like to see a textual and code representation of what this looks like to screen reader users, Steve Faulkner has written it up for you.
When adding the alt attribute to images using WordPress, as long as you’re using the media editor, adding line breaks is not easy to do unless you’re a coder and you add the HTML directly to the box for the alt attribute. Coding it manually is a completely different story.
Why add line breaks in the first place?
It’s my opinion, (and I could be completely wrong about this), that some add line breaks to their alt attributes for stylistic reasons. They want to add text that’s meaningful, but they also want to make sure that text doesn’t look out of place on the front end, assuming the image isn’t being displayed and the text is then visible. So they add line breaks to keep things tidy.
One way you can avoid having to do this is to make sure that your alt text is not only meaningful, but as short as possible. There’s no set limit on the number of characters the alt attribute can hold, but think of it as Twitter for images.
With Twitter, there’s a character limit imposed. So you have to say what you want in as few characters as possible. Treat your alt attributes the same way. Make sure the text is meaningful, but try to keep it as short as possible. The less verbose, the better.
None of this is a hard and fast rule. HTML is extremely forgiving, and it won’t warn you if your alt text is too long. But by making it a point to keep it short, meaningful and to the point, you’ll make those of us who read your sites with screen readers a lot happier.