linux1880 Posted May 18, 2010 Share Posted May 18, 2010 hi folks how to add css styles to html elements using javascript ? pls help Thanks Quote Link to comment Share on other sites More sharing options...
Omirion Posted May 18, 2010 Share Posted May 18, 2010 element.style.[property] = value //prototype Example: var elem = document.getElementById("myDiv"); elem.style.left = 100px ; Quote Link to comment Share on other sites More sharing options...
Ang3l0fDeath Posted May 23, 2010 Share Posted May 23, 2010 elementObject.style //This is how you tell an elementObject its going to be styled in CSS elementObject.style.color='white';// OR ='#ffffff'; elementObject.style.backgroundColor='red';// OR ='#800000'; elementObject.style.padding=5; elementObject.style.textAlign='center'; hopefully thats enough examples for you to understand it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.