I assume that you only want to focus horizontally.
My solution uses flexbox with justify-content: center to align elements located inside the container. Elements are the three components of the title: text before, “word”, text after.
HTML:
<h1 class="word-centered"><span>Welcome to the great </span><span>Stackoverflow</span><span> universitiy</span></h1>
The title is divided into three parts: the centered word in the second span .
CSS
.word-centered { display: flex; justify-content: center; } .word-centered span:nth-child(1), .word-centered span:nth-child(3) { flex: 1; margin: 0 5px; } .word-centered span:nth-child(1) { text-align: right; }
Demo: http://jsbin.com/foduvuvoxa/1
This works in FF 34 and Chrome 39, so vendor prefixes are required for IE 10/11.
source share