Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // select an element to style
- const container = document.querySelector('#container');
- // this is not ideal...
- container.style.width = '400px;';
- container.style.height = '300px';
- container.style.top = '0';
- container.style.left = '50%';
- // let's assign all styles in one go!
- Object.assign(container.style, {
- width: '400px',
- height: '300px',
- top: 0,
- left: '50%'
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement