Sunday, 15 September 2013

CSS in the html tags, text not staying in box

CSS in the html tags, text not staying in box

I'm sending emails within my PHP application. I know it's not recommended
but to keep things simple I just want to put the CSS style in the tags.
I've tried this:
<div style=\"width: 500px; height: 600px; background-color: green;\">
<h1>Title</h1>
<div style=\"width: 460px; height: 540px; background-color: white;
margin-top: 10px; margin-left: auto; margin-right: auto;\">
$content
</div>
</div>
The styling works fine but the $content string is quite long and the text
just flows out of the box instead of neatly going to the next line. Is
this something particular when you use the style attribute in tags? Or
does it have to do with the way email clients read the email out?
Is there a way I can fix this without using an external CSS file?

No comments:

Post a Comment