For optimal HTML structure, it is recommended to always include another element within your code. For instance, enclose your text in <p>
tags.
By doing so, you create a designated area where you can easily apply styles such as setting the margin
or padding
.
If for some reason you are unable to have an inner element, consider removing the width
property and using right: 0
. When working with absolutely positioned elements, aligning opposing positions at 0 can effectively stretch the element (this technique also applies to top/bottom alignments).
Alternatively, if your element is not absolutely positioned, modify width: 100%
to max-width: 100%
(or add the max-width
line to address compatibility issues with older versions of IE). This adjustment will enforce a maximum width limit. See this concept in action here - http://jsfiddle.net/3FrLq/5/.