0

I wrote a code in html CSS java script of a signature for an email, that I copy the signature and paste all the features of the CSS have gone except the display flex. its makes the image go up instead of being on the left side of the text.. what should I do? I try to change the display flex to float left and its works . but its tuff to change it in all my project. I want to solve this with my CSS code.

document.getElementById(arr_1[i]).addEventListener('click', function () {
    // Create a new element with the signature HTML
    const signature = document.querySelector(`#${arr_2[i]}`);
    signature.innerHTML = document.getElementById(arr_2[i]).innerHTML;

    // Convert the image to base64 and set the src attribute
    var img = signature.querySelector('img');
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext('2d');
    var imgWidth = img.width;
    var imgHeight = img.height;
    canvas.width = imgWidth;
    canvas.height = imgHeight;
    ctx.drawImage(img, 0, 0, imgWidth, imgHeight);
    var base64 = canvas.toDataURL();
    img.setAttribute('src', base64);

    // Copy the signature HTML to the clipboard
    var range = document.createRange();
    range.selectNode(signature);
    window.getSelection().removeAllRanges();
    window.getSelection().addRange(range);
    document.execCommand('copy');
    window.getSelection().removeAllRanges();

    // Show a success message
    alert('Signature copied to clipboard!');

0 Answers0