Hints and Tips - Cutting and Pasting into HTML
The ability to 'cut and paste' is one of the most wonderful elements of electronic word processing. Not having to re-type everything is a huge time saver and I can't imagine filling an entire Web site without doing at least a little cut and paste from somewhere. However, when doing this for the first time, you may discover that what you've pasted doesn't always look like what you started with. This article will explain how to cut and paste, why re-formatting can happen and what you can do to increase your chances of your 'cut and paste' process being smooth and seamless.
Keyboard shortcuts
Before we get started, let me share a trick that will help get you cut and pasting like a pro. Many basic functions of Windows have what are called 'keyboard shortcuts' which are a combination of keys pressed at the same time to produce results that normally you'd have to use your mouse and the interface of the software to create. Cut, copy, and paste are three of these functions. Their keyboard shortcuts look like this:
CTRL+X = Cut
CTRL+C = Copy
CTRL+V = Paste
By using these shortcuts you can cut, copy, and paste into and from most Windows compatible software without even needing to access a menu or click a button.
What You Get is More Than What You See
Most times when you cut and paste text, you will do so from a word processor, such as MS Word, MS Works, or perhaps MS Publisher. These word processors do a wonderful job of making our lives easier by spellchecking and formatting our text. They frequently have many other functions as well that serve to make our printed material look clean, crisp, and professional. Most people use them so regularly, that they never stop to think about how these word processors do all this. The answer is complicated programming that is invisible to the user (assuming your software is working correctly). All these programs use personalized coding that is attached to every keystroke you make. This personalized computer code and formatting allows the word processors to give you a finished product that looks very nice.
When you highlight text in a document, however, and copy it, what you are copying is not just the text, but all the word processor code that is attached to that text as well. When you paste this text with its code into another piece of software, that software may not be designed to interpret the formatting code for that text the same way the processor it came out of did. This happens very commonly with HTML - the formatting code of Web pages and the Internet. Let me give you an example. I am going to show you what the code looks like for a simple sentence and then show you what the HTML code ends up being when that same sentence is cut and pasted in from a word processor (MS Word in this example.)
| "The quick brown fox jumped over the lazy dog." |
When this sentence is typed directly into HTML (as it would be if you typed it directly into your WebMedley editing window) the HTML code for it looks like this:
| <P>"The quick brown fox jumped over the lazy dog."</P> |
(The <P> and </P> are HTML code for the beginning and end of a paragraph.)
Here's what the same sentence looks like when copied out of MS Word, using a Verdana font set to a font point size of 10:
| "The quick brown fox jumped over the lazy dog." |
Looks the same on the surface, doesn't it? That's why we have to look deeper. Its HTML code ends up looking like this when cut and pasted into WebMedley:
|
<P><SPAN style="FONT-SIZE: 10pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">"The quick brown fox jumped over the lazy dog."</SPAN></P> |
As you can see, there is a very radical difference. Multiply this difference over many, many paragraphs and formatting elements in the document you cut and paste from and you can see why HTML sometimes has trouble interpreting this 'simple' cut and paste.
So, while you thought you were only cut and pasting a single sentence from your word processor, you were actually cut and pasting much, much more.
It is all this extra code that will also sometimes keep your text from responding to your input using the WebMedley editing toolbar since the commands that the toolbar adds just gets lost in the middle of all the other unnecessary code that the word processor has brought in.