Answers for ".style.{property} javascript"

2

js style

const title = document.querySelector('h1')

//title.setAttribute('style', 'margin: 50px');

console.log(title.style); // Show all style propertyes
console.log(title.style.color); // Log a color in console

title.style.margin = '50px'; // Set a margin of title
title.style.color='crimson'; // Set a color of title
title.style.fontSize = '60px'; // Set font size of title
Posted by: Guest on July-19-2020
1

style through javascript

element.style.backgroundColor = "red";   // set the background color of an element to red
Posted by: Guest on July-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language