I need help centering an inline element (like a span) within a fixed-width block element. The goal is to have the position of the inline element determine how the text is laid out in the block element.
Here's an example:
.container {
width: 200px;
white-space: nowrap;
overflow: hidden;
}
.centered {
/* NEED TO CENTER THIS HORIZONTALLY INSIDE THE CONTAINER DIV */
}
<div class='container'>
Lorem ipsum dolor sit amet, ullum latine vituperatoribus sed ad, ut sit nihil sententiae. Ad minim prodesset eum, mei ei <span class='centered'>dicam</span> facete accusata, sea nonumy postulant ut. No fabellas facilisis mel, iriure constituto constituam vix te. </div>
Here is a visual representation of what I'm trying to achieve: https://i.sstatic.net/6HOF1.png
Appreciate any assistance with this issue.