window.onload=function() {
var img = document.querySelector('img')
var size=100;
img.width=size;
img.height=size;
img.style.width=size + 'px';
img.style.height=size + 'px';
}
Hello, I have a question from the above code.
img.width = number
, img.style.width = number+'px'
I know it's the same as a result, but
I'm just curious about the difference between the two. People around me say it's a useless question, but this is how the grammar works Can I think about it?
javascript css width img
As you said, it doesn't seem to mean much to distinguish the difference between the two.
That's where we'll find meaning.
© 2024 OneMinuteCode. All rights reserved.