Applying contrasting background for titles is considered to be one of the latest tendencies in web design. See example below:

At first sight this task seems to be quite easy, however it may be difficult to realize it. Using «add padding» option you will begin to experience certain difficulties. The point is that padding is added to beginning and the end of text only. So, all line breaks will be ignored.

Once upon a time this task was almost solved by Yuriy Artyukh. The method was based on adding border to a child element. Nevertheless, the work hasn’t been 100% completed. There was no padding at the end of the first string (the place, where words are carried to) anyway. Other solutions I was sent via Twitter had the same problem. Line breaks had not been specified correctly.
So, how to do this?
