2 replies [Last post]
px2co
Offline
newbie
Last seen: 12 years 25 weeks ago
Joined: 2010-02-18
Posts: 3
Points: 5

Hi all,

First off, I'm really not a web coder, I have SOME CSS knowledge, but am not great!

I have a site, which is all working lovely, using a linked style sheet. I need to make a one off HTML email, using the same styled layout, but need to make my style.css local to the HTML file. I'm not having much success. I can see how to add the text stylesheet to the header, how do I do it for the style.layout?

So basically I need to have the styling for each div on this html page.

If it helps, I've attached a text version of my template code.

Any help very gratefully accepted.

Michele

dmikester1
Offline
Regular
Last seen: 12 years 25 weeks ago
Timezone: GMT-6
Joined: 2007-05-24
Posts: 36
Points: 19

I don't really see an

I don't really see an attachment anywhere. But what you are looking for is an internal stylesheet.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>
</head>
<body>
</body>
</html>

Mike

flamenco
flamenco's picture
Offline
Enthusiast
US, East Coast
Last seen: 11 years 31 weeks ago
US, East Coast
Timezone: GMT-5
Joined: 2009-04-13
Posts: 240
Points: 144

Hi Michelle, That's a very

Hi Michelle,
That's a very good question. I've made a lot of enewsletters by now. The answer may surprise you... using an external stylesheet, or even trying to use one in the HEAD of your HTML code, will give very spotty results across email clients. You essentially must use tables(!), and must use inline styles, if you want your enewsletter to be compatible with the greatest number of email pop and webmail clients. You have to party like it's 1995! Smile The code required is just filthy, IMHO, but I can do it as needed. Smile

As far as I can tell, people who develop email clients have no agreement on standards or formats, so getting an enewsletter that will work in a majority of them is amazingly difficult. And beyond that, whatever Google does dominates anyway. Here are some good tips:

http://net.tutsplus.com/misc/6-easy-ways-to-improve-your-html-emails/

But learning the bizarro enewsletter techniques is a lot of work, especially if you're a CSS newbie. If you're just doing a one-off, maybe you can just make an alternate page with mostly text, as few images as possible, and maybe a color or two, and use that for the newsletter.

Good luck, Dave