I don't think this is an everyday dropcap situation.
My capital "S" is an image like this:
Please note that the actual image extends all the way to the upper column. The top bar is part of the same image, containing the large S and the drawing to the left of the S. I colored the background blue so it can be easily seen here, but the natural color is white. (But please ignore the extra gray area at the very top, it's awkward when doing screen captures.) I don't want to break the top bar and image. The image provided to me looks like this - a rectangular area with a top bar drawn in the upper right corner and white space below the top bar.
I want the text to look like this (created using paint.net):
Note that the first line of text is aligned with the bottom of the capital "S"; the first three lines are at the top of the white area in the image, and lines four through six are left aligned with the page margin.
Also note that the text must cover the white portion of the image.
Also note that I cannot guarantee total text width; this will be an EPUB and can be viewed on multiple devices. Therefore position:absolute
should definitely be avoided.
Here's the HTML I've tried so far, almost completely removing the relevant CSS:
HE ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco. Laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in Voluptate velit essence cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Thank you.
It is impossible to give a specific value because the position of "S" in the actual image is not measured. The following images are used inExample A, and the same technique is used inExample Bto add new images to the OP.
.foreground
is floated, with the paragraph's text wrapped around it..background
is positioned below all content so that.foreground
covers 150 pixels of.background
and the paragraph text is above. background
.Important rule sets commented in the examples
Example A
Example B
Edited by OP:I've edited this answer so it's very close to what I want, to match my exact use case.
One of the automotive S.O. suggested web links ("vertical-align-text-next-to-an-image") provides ideas (as well as another link (epub knowledge).
The example we posted uses transform translation.
There are other factors to consider when it comes to e-books… Keep in mind that e-book users can change the font size in "reflowable" e-books (which we assume is your goal). Each e-book reader may set their preferred font size differently. You need to consider this factor as well. Perhaps readers might choose a series of @media commands for various potential font sizes. This sample was tested in FF, Chrome, Edge.
To further prepare to suit your project: