How does one have centered text and right-floating text on the same line, when everything has dynamic widths?
问题 I have a variable size block of text, which I would like centered in a div. The width of the div is a % of its parent element, and the height is defined by padding however tall the center text is. This is easily achieved via: <div style="width: 50%; padding: 15px; text-align: center;"> Lorem ipsum... </div> That works fine. But when I try to add the part on the right: <div style="width: 50%; padding: 15px; text-align: center;"> Lorem ipsum... <div style="float: right;">ASDF!</div> </div> then