java-html2image icon indicating copy to clipboard operation
java-html2image copied to clipboard

The HtmlImageGenerator is ignoring the horizontal aligments of two divs.

Open xBurnsed opened this issue 2 years ago • 2 comments

Hello,

Is there any way around this?

I have tried display: flex, display: inline-block, float: left.. etc

All of them are being ignored and when the image is generated, the are placed one on top of the other.

For example:

Expected:

image

Result:

image

xBurnsed avatar May 26 '23 23:05 xBurnsed

Not that I'm aware of. If you can supply a fix, I'm more than ready to merge it in.

hkirk avatar May 30 '23 07:05 hkirk

I've tried the following code and it's working as expected, at least with my forked version

if you want to try it you can use jitpack.io to include it as a Maven dependency

<!DOCTYPE html>
<html>
<head>
<style>
.container {
	background-color: DodgerBlue;
}
.container > div {
	display: inline-block;
	background-color: #f1f1f1;
	margin: 10px;
	padding: 20px;
	font-size: 30px;
	text-align: center;
}
</style>
</head>
<body>
<h1>Inline Block divs</h1>
<div class="container">
	<div style="width: 32px">1</div>
	<div style="width: 64px">2</div>
	<div>3</div>
</div>
</body>
</html>

pizzi80 avatar Aug 29 '24 18:08 pizzi80