I noticed how CSS has Cross-Browser arguments such as -webkit-
, and -moz-
as well as Media Queries
. Does JavaScript Have an equivalent using element.style.["Cross-Browser];
or any other method? I usually use JavaScript to define all of my elements and I am considering switching to HTML and CSS. Here is an example for this problem is:
CSS
#div{
-webkit-padding:4px;
-moz-padding:4px;
}
JavaScript
window.addEventListener("load", Start);
function Start(){
var Div = getElementById("div");
Div.style.padding = "4px"; //Universal [Works!]
Div.style.moz.padding = "4px"; //Firefox [Doesn't Work! Why?]
Div.style.mozPadding = "4px"; //Firefox [Doesn't Work! Why?]
Div.style.webkit.padding = "4px"; //Chrome or Opera [Doesn't Work! Why?]
Div.style.webkitPadding = "4px"; //Chrome or Opera [Doesn't Work! Why?]
document.body.appendChild(Div);
}