Wrong.
Email, for whatever reason, is far behind the evolution of web browsers. While the basic html coding is very similar, it lacks much of what makes modern websites so wonderfully easy to create. Specifically, I am referring to CSS, or cascading style sheets. For those non-tech-geeks out there who actually have a life to lead, CSS is what coders use to make things the right shape, size, color and appear in the right place on the screen. Here is an example of why web developers love CSS.
Say I wanted to create a string of text, but I want to make the text red. Using the old school approach, I would use the html attribute of "color" like this:
<p color="red">This is some text.</p>
Using the css version, it would use the css style of "color" which would look like this:
<p style="color:red">This is some text.</p>
Now, some of you might say, "Wait, but that uses more text. Wouldn't that make it slower to code, not faster?" True, if that was all we were doing, it would be slower. There are two things to consider. One is that every additional style could be put in the same style attribute. So, if we wanted the text to be sized to 18px, have a black background, and align in the middle, the code would be, for attributes:
<p color="red" bgcolor="black" align="center" ><font size="4">This is some text.</font></p>
And for CSS:
<p color="red;background:red;text-align:center;font-size:18px">This is some text.</p>
Now, the CSS has become smaller. Also you will note the severe disadvantage of the old attributes when it comes to font size. It not only requires a separate "<font>" tag, but the sizes were limited to a set scale between 1 and 7. Size "4" is about equal to 18px, but size "5" would be about 24px. If I wanted the text to be 20px or 22px, I would be out of luck.
The second big advantage for CSS is the ability to change specific elements, or to change a specific group of elements. Say that instead of making one <p> tag red, I wanted to make all of the <p> tags red. With attributes, I would need to declare it separately for each. For CSS, I can declare it once. Here is the attribute version:
<p color="red">This is some text.</p>
<p color="red">This is some more text.</p>
<p color="red">This is the third line of text.</p>
<p color="red">Here is the rest of the text.</p>
<p color="red">This is some more text.</p>
<p color="red">This is the third line of text.</p>
<p color="red">Here is the rest of the text.</p>
The CSS version would declare it once, like this:
<style type="text/css">p{color:red;}</style>
<p>This is some text.</p>
<p>This is some more text.</p>
<p>This is the third line of text.</p>
<p>Here is the rest of the text.</p>
<p>This is some text.</p>
<p>This is some more text.</p>
<p>This is the third line of text.</p>
<p>Here is the rest of the text.</p>
The end result is that I would be able to change all of the p tags on all of the webpages in my site simultaneously, which saves a lot of time.
Stay tuned for my next post, where I continue my story of creating an html email template and describe my endless frustrations with a former html friend: tables.
Until next time...
No comments:
Post a Comment