A tagged word sits in the line with a padding, a border and a background of its own, and the words around it move over to make room for the padding.
Side margins keep the box apart from its neighbours, and a dashed box around a solid one nests inside the same line.
A box that runs on for long enough is cut by the line break: these words carry the box across the end of the line and onto the next one, where it goes on without a left edge and closes with a right one and then the paragraph ends as usual.