Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. // select an element to style
  2. const container = document.querySelector('#container');
  3.  
  4. // this is not ideal...
  5. container.style.width = '400px;';
  6. container.style.height = '300px';
  7. container.style.top = '0';
  8. container.style.left = '50%';
  9.  
  10. // let's assign all styles in one go!
  11. Object.assign(container.style, {
  12. width: '400px',
  13. height: '300px',
  14. top: 0,
  15. left: '50%'
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement