Then what is the difference?
The difference lies in datatype. As its clear in code that with css method you need to append 'px' to the width value and with width you don't need to specify.
When you want to read width of any element then css method will return you string value like '100px' while width will return an integer value.
This return '100px'.
This returns 100.
So if you want to do any kind of manipulation then width function is the best option.
The same difference is with height and css('height').
Feel free to contact me for any help related to jQuery. I will gladly help you.