Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!