How does gmail preserve copy and pasted web content, maintaining the attached CSS?
I'm not sure how long the feature has been active, but I've just realized that I can copy and paste nearly any web content into a message on gmail and it will preserve it perfectly-- zero transcription errors. The images, formatting, and all-around CSS are perfectly preserved.
Yet if you paste the same thing into a textbox, of course it gets converted to some sort of plaintext.
I'm trying to figure out how this is possible. How can gmail know the styling for the web content? How can it know where it came from?
This is happening in Chrome, by the way. I don't even know if this is a feature of the browser, the email provider, or a combination thereof.
It is a combination of OS, the source application from which you are copying, and the destination application to which you are pasting.
The source application should permit selection and copying of rich information.
The OS cut/paste functionality needs to understand what the rich content is.
The destination application needs to understand what the rich content is and how to handle it.
When you cut paste HTML page information, CSS is not copy pasted. The information displayed on the screen is copied as rich content and then pasted onto destination system.
Gmail 'understands' how to interpret, correctly, the information pasted into it. A text program also understand how to interpret the information - it knows that it should discard e.g. all images.
MS Word e.g. makes copious mistakes while pasting HTML content. It does not understand, well, how to understand HTML.