Image width doesn't modify the container width only the image #591
Replies: 4 comments
-
Hello @pbrentlinger I guess you would expect the paragraph to be on the left of the image? $ asciidoctor-pdf --version
Asciidoctor PDF 1.5.0.beta.8 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8) The So it really depends on your image width. As you can see there's not enough space for the text to be on the left of the image. As a consequence, the text is pushed above the image. Now, the image width is 320px: In this case, the text can fit of the left of the image. == Section
[.columns-2]
--
The exploded pie chart example "Europe browser usage share" was created using the ConceptDraw PRO diagramming and vector drawing software extended with the Pie Charts solution of the Graphs and Charts area in ConceptDraw Solution Park.
image::pict-exploded-pie-chart-europe-browser-usage-share.png["Europe browser usage share"]
--
== Section
Some text.
Some text.
Some text. .columns-2 > .content {
display: flex;
}
.columns-2 > .content > * {
flex: 0 0 50%;
padding-right: 2rem;
} And here's the result: Using a SVG image is probably another way to fix this issue. |
Beta Was this translation helpful? Give feedback.
-
Keep in mind that I might be wrong in my analysis. I'm not really familiar with the |
Beta Was this translation helpful? Give feedback.
-
Ok, so I wasn't aware of the However, from a plain text file, it doesn't seem rational that defining the width of the image would not also define the width of the generated content box's made by asciidoctor-pdf.js. I've included the defined behavior from the user manual for reference.
This floating-issue is a known problem in the ruby version. This web version is meant to deal with problems like this (this is how I found this project). For reference: |
Beta Was this translation helpful? Give feedback.
-
Maybe but that's not how it's currently working in the built-in HTML 5 converter. The width attribute only applies to the image width (not the content box). Not sure if it's intended or not...
It depends on what you want to achieve. If you apply a 50% width on a 320px width image, it will produce a 160px width image. Even if the content box has a 160px width that's not the same as a two columns 50% width layout.
Looking at the code of Asciidoctor PDF, I believe that the following definition are equivalent:
From the code documentation:
In your case, the value is the same (and not in pixels), so a width of 50% will be applied.
Actually, it does work if you use the following definition:
But the width of your image must be lower than the width of the page. Here's an example with a 320px width image: |
Beta Was this translation helpful? Give feedback.
-
my code:
Beta Was this translation helpful? Give feedback.
All reactions