question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

html2canvas doesn't work with display: -webkit-box

See original GitHub issue

I’m trying to embed posts of my app, and then making screenshot of the embeded post, in the screenshot of the post i want to show only 5 lines of content text and 3 dotes at the end , therefor i’m using this code of CSS :

.limit-text-to-5-lines {
			display: -webkit-box;
  		-webkit-line-clamp: 5;
  		-webkit-box-orient: vertical;  
  		overflow: hidden;
		}

But i see nothing in content section of the screenshot, i tried without display: -webkit-box; it shows me the text ,so it’s a conflicts , and not works, please some help!

Specifications:

  • html2canvas version tested with: react
  • Browser & version: all
  • Operating system: mac

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
n1ks0Ncommented, Dec 3, 2020

content: “”; position: absolute; right: 0; width: 1em; height: 1em; margin-top: 0.2em; background: white; /* use necessary background-color */

first of all thanks for your comment, but i already have this code , the problem here that i want the 3 dotes right after the last word, but the location of those 3 dotes in this case are always located at the end of the last line even though you have just 2 words in the line so you 'll have a huge space between the last word and the 3 dotes !

so, it’s better than nothing) what’s stopping u from changing css-code for urself?

1reaction
n1ks0Ncommented, Dec 1, 2020

CSS code instead of line-clamp:

.block-with-text {
  overflow: hidden;
  line-height: 1.2em; /* use this value for height */
  max-height: 3.6em;  /* max-height = line-height (1.2) * number of lines (3) */
  text-align: justify;
}

If you want dots at the end, like line-clamp:

.block-with-text {
  overflow: hidden;
  position: relative; 
  line-height: 1.2em;
  max-height: 3.6em; 
  text-align: justify;  
  padding-right: 1em;
}
.block-with-text:before {
  content: '…';
  position: absolute;
  right: 0;
  bottom: 0;
}
.block-with-text:after {
  content: "";
  position: absolute;
  right: 0;
  width: 1em;
  height: 1em;
  margin-top: 0.2em;
  background: white; /* use necessary background-color */
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML2Canvas does not render full div, only what is visible on ...
When this code runs, it only renders what is visible on the screen. The #potenzial-page div is essentially the entire page, minus the...
Read more >
Features - html2canvas
Discover the different features supported by html2canvas. Below is a list of all the supported CSS properties and values. background. background ...
Read more >
jsFeedback implementation using html2canvas plugin (Tutorial)
It creates the view by traversing the DOM of the webpage. Technically it does not take the screenshot but simulate the view of...
Read more >
Lessons Learned from Converting Html to Image - Medium
If you have this problem, removing all unnecessary CSS or CSS frameworks may solve the problem. html2canvas. Problem. html2canvas adds extra padding at...
Read more >
html2canvas - Bountysource
Please make sure you are testing with the latest release of html2canvas. Old versions are not supported and issues reported for them will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found