Advertisement
Ant8893

JS Watermark

Oct 22nd, 2023
886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const watermarkDiv = document.createElement('div');
  2.  
  3. watermarkDiv.style = `
  4.   position: fixed;
  5.   margin: 15px;
  6.   bottom: 0;
  7.   left: 0;
  8.   width: 200px;
  9.   height: 80px;
  10.   border-radius: 15px;
  11.   background-color: rgba(0, 0, 0, 0.5);
  12. `;
  13.  
  14. const watermarkTextTitle = document.createElement('div');
  15. watermarkTextTitle.style = `
  16.   position: absolute;
  17.   top: 10px;
  18.   left: 0;
  19.   width: 100%;
  20.   text-align: center;
  21.   font-size: 16px;
  22.   font-weight: bold;
  23.   color: white;
  24.   font-family: Arial, sans-serif;
  25. `;
  26. watermarkTextTitle.textContent = 'Title';
  27.  
  28. const watermarkTextDescription = document.createElement('div');
  29. watermarkTextDescription.style = `
  30.   position: absolute;
  31.   top: 30px;
  32.   left: 0;
  33.   width: 100%;
  34.   text-align: center;
  35.   font-size: 12px;
  36.   font-weight: normal;
  37.   color: white;
  38.   font-family: Arial, sans-serif;
  39. `;
  40. watermarkTextDescription.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum commodo velit.';
  41.  
  42. watermarkDiv.appendChild(watermarkTextTitle);
  43. watermarkDiv.appendChild(watermarkTextDescription);
  44.  
  45. document.body.appendChild(watermarkDiv);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement