SHARE
TWEET

Untitled

a guest Oct 21st, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top