Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Is it legitimate to use span's in a post title in Wordpress?

I wonder would it be a legitimate way to use span tags in a Wordpress post title like e.g.

<span class="first">Hello</span> <span class="second">World</span>

Would offer the opportunity to wrap the text on a specific breakpoint to bypass width issues on smaller viewports. Best regards Ralf

p.s. tried it on one post title and it worked without any problem - just uncertain if it is tooooo hacky. ;)

2 Answers

Matt Campbell
Matt Campbell
9,767 Points

That's fine. It's exactly what <span> is for in fact. Targeting something within a line of text is one of the top uses for span, if there's more than 1 that is. Can't remember.

oh and a brief follow question. i suppose the space entity is allowed too?

<span class="first">Hello&nbsp;</span>World

uhhh thanks. that's some kind of a relief. i try to keep things clean normally and that way looked quite hacky. but every other workaround would implied a pile of work so i am just glad now. ;)

oh and indeed. the second span wouldn't be necessary. will look at least only half awkward now in the list view in the backend :D

thanks again!