javascript style an element
// Getting the element first
var myElement = document.querySelector("#myElement");
// examples for updating styles
myElement.style.color = "blue";
myElement.style.backgroundColor = "red";
javascript style an element
// Getting the element first
var myElement = document.querySelector("#myElement");
// examples for updating styles
myElement.style.color = "blue";
myElement.style.backgroundColor = "red";
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
style through javascript
element.style.backgroundColor = "red"; // set the background color of an element to red
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us