Table width CSS in newsletter - css

I've run into an issue with column widths where they are being completely ignored in CSS and HTML while trying to set up a newsletter page. Here's the style sheet:
h3 {
font-family:bitter;
font-weight:500;
font-size:14pt;
}
table {
border-collapse: collapse;
border:0px;
width: 700px;
table-layout: fixed;
margin-top:0px;
margin-bottom:0px;
margin-right:0px;
margin-left:0px;
margin: 0;
text-align: justify;
line-height: 150%;
}
td {
font-family: arial;
font-size: 11pt;
padding: 1em;
font-weight: 600;
vertical-align: top;
margin-top:0px;
margin-bottom:0px;
margin-right:0px;
margin-left:0px;
}
Here's the table:
<table>
<tr><td colspan="2"><img src="img.jpg" width="600" height="108"></td></tr>
<tr><td class="greybg" colspan="2">For those who ever wondered why such an exciting company had such a less-than-
exciting newsletter, we heard you. That is why we are proud to announce our new look and, more importantly, new tone to
how we communicate with you. Take a few minutes to browse through our new features, such as grammar tips from our
editors, profiles and helpful advice from one of our top authors, along with the latest news and innovations, including
new videos and the recently launched Textbroker University, our exciting new program to help our 3-star authors become
4 stars! With all the great things happening, there has never been a better time to be a part of Textbroker!</td></tr>
<tr>
<td class="orangebg" rowspan="3" style="width:70%;"><h3>CLASS IN SESSION!</h3>
If you have ever wondered how to become a 4-star author and earn more money at Textbroker, there is now Textbroker
University! Our unique three-course curriculum was designed to correct the most common reasons authors are rated at 3
stars. The process is easy. Just use the link to <a href="http://www2.textbroker.com/textbrokeruniversity">sign up
here</a>. You get:
<br />• Expedited ratings of your five most recent articles
<br />• Our three courses, including:
<br />• Our blog on avoiding filler content
<br />• Our podcast and exercise on proofreading
<br />• Our video and exercise on commas
<br />• Once you finish, you can submit 10 articles for re-evaluation
<br />The course is free, and you can review the material as much as you want, so there’s no reason not to raise your
rating--and start making more money. In addition to a higher per- word rate, 4-star authors also have access to more of
our lucrative TeamOrders. These can provide a steady stream of work in specialty areas that pay more than the usual 4-
star rate! Don’t wait for the late bell. Sign up now!</td>
<td class="whitebg" style="width:30%;">
<h3>FUN FACT OF THE MONTH</h3>
Did you know that 4-star authors can earn 40 percent more than 3-star authors for an article of the same
length? Sign up with Textbroker University, and let us show you how to be a 4-star author in no time!
<br />
</td>
</tr>
<tr><td class="dkgreybg" style="height:20px; width:30%;"></td></tr>
<tr>
<td class="whitebg" style="width:30%;"><h3>GETTING STARTED</h3>
Starting something new can be intimidating, and our system is no different. Now, we make the process easier
with the latest in our series of videos available on Youtube. Please follow the link to our New Author Registration Video to help you get started! Feel free
to share with your friends, so they can start writing for Textbroker too. More videos coming soon to help you get the
most out of Textbroker!
</td>
</tr>
<tr><td class="greybg" colspan="2">
<h3>PROLIFIC AND PROFITABLE PROFILES</h3>
</td>
</table>
From within, here's the section of columns that aren't working:
<td class="orangebg" rowspan="3" style="width:70%;"><h3>CLASS IN SESSION!</h3>
If you have ever wondered how to become a 4-star author and earn more money at Textbroker, there is now Textbroker
University! Our unique three-course curriculum was designed to correct the most common reasons authors are rated at 3
stars. The process is easy. Just use the link to <a href="http://www2.textbroker.com/textbrokeruniversity">sign up
here</a>. You get:
<br />• Expedited ratings of your five most recent articles
<br />• Our three courses, including:
<br />• Our blog on avoiding filler content
<br />• Our podcast and exercise on proofreading
<br />• Our video and exercise on commas
<br />• Once you finish, you can submit 10 articles for re-evaluation
<br />The course is free, and you can review the material as much as you want, so there’s no reason not to raise your
rating--and start making more money. In addition to a higher per- word rate, 4-star authors also have access to more of
our lucrative TeamOrders. These can provide a steady stream of work in specialty areas that pay more than the usual 4-
star rate! Don’t wait for the late bell. Sign up now!</td>
<td class="whitebg" style="width:30%;">
<h3>FUN FACT OF THE MONTH</h3>
Did you know that 4-star authors can earn 40 percent more than 3-star authors for an article of the same
length? Sign up with Textbroker University, and let us show you how to be a 4-star author in no time!
<br />
</td>
</tr>
<tr><td class="dkgreybg" style="height:20px; width:30%;"></td></tr>
<tr>
<td class="whitebg" style="width:30%;"><h3>GETTING STARTED</h3>
Starting something new can be intimidating, and our system is no different. Now, we make the process easier
with the latest in our series of videos available on Youtube. Please follow the link to our New Author Registration Video to help you get started! Feel free
to share with your friends, so they can start writing for Textbroker too. More videos coming soon to help you get the
most out of Textbroker!
</td>
</tr>
Divs and floats aren't an option because this needs to go in an email. No idea why this isn't working. I've researched this heavily before asking and added a few things to my header that would seem to fix the problem. Do I need to specify the width in the whitebg class? I'd prefer not to so that I can use it later for any width of column.
Try fiddling the width. I'm in Chrome: http://jsfiddle.net/W29Ea/1/

Related

Center property seems 'shifted' and table mis-position

Being a customer service staff with limited access to basic html, I've been assigned a task that beyond my skill about making a decent page of highlight items, after series of search around, I somehow get things working, well, in firefox, when I load up the the same content in Chrome & IE, I found different problem and to my best effort, I have no idea what cause the problem...
You might first wish to look at the firefox version as it display perfectly as I wanted it to:http://jsfiddle.net/kitchellw/TR6v5
(and I don't know why the first line doesn't apply the CSS...)
In IE, the round corner gone, which I won't worry too much... but
padding is gone...
the lower table looks like a mess
I found a way to tackle the image border, just border=0
In chrome,
while the upper section looks ok, the content in lower table seems 'shifted' to right by a few pixels and no longer stay center
Here is the exact code for the problem table at the lower section:
<table class=highlightitem>
<tr>
<td height="200" valign="top" >
<center>
<a href="http://www.digitalbuydirect.com/index.php?route=product/category&keyword=DSC-TX30" target="blank">
<img width=234 src="http://www.digitalbuydirect.com/edm/eDM20130516/TX30.png" /></a>
</center>
</td>
</tr>
<tr>
<td height="200" valign="top" >
<font class=product><B>some text</b></font><br><br>
<font class=content>some text</font><br>
<br>
<font class=pricehighlight><B>price</font><BR>
<font class=content><s>other price</s></font>
</td>
</tr>
<tr>
<td align="right" height="50" valign="bottom" >
<img src="http://www.digitalbuydirect.com/edm/achieve/shopnow_35.png" /> </td>
</tr>
</table>
and finally, I know my code is complex by using multi-table to control the vertical position, and CSS is my friend here, but i were unable to get the 'shop now' icon station at the lower right corner with clickable url attach with it, I found a CSS background image with a display block for the url might work, but the display block still request at least 1 character, which I cannot afford on my image. Any hint or direction would be appreciated.
First of all, you should really clean up your deprecated code.
So far the things I've seen that are deprecated or not supported anymore are as follows:
<center> - Use CSS text-align:center; reference
<font> - Use another element like <p> coupled with CSS text styling
<td align="right"> - Use CSS float:right; reference
<td valign="top"> - Use CSS vertical-align:top; reference
As for your IE padding problem, take a look at this question. I'm not sure if that's applicable though, since you didn't include your CSS in the question, so I don't know how you implemented the padding you already have.
As for centering, using margin:0 auto; will work for statically positioned elements. For absolutely or fixed position elements I do this: #elementID{width:800px[specify width]; left:-400px[negative half of the width]; margin-left:50%;}

Align table content

I have a Wordpress site and I'm trying to align some text with an image using a table.
For some reason the image appears higher than the text on my site
Any assistance is very much appreciated.
The page is here:
http://pictureperfect.kpwebservices.net/about/
This is my code:
<table style="width: 86%;" border="0">
<tbody>
<tr>
<td width="50%"></td>
<td width="50%"></td>a
</tr>
<tr>
<td>Our aim is to ensure you look and feel your best on your special day. Whether it is your Wedding day, formal, Deb, Spring Carnival, photography and any occasion in between.
Picture Perfect Makeup is a mobile service catering Melbourne, surrounding and outer suburbs. We will come to your doorstep for your own comfort.
Mary Kechichian- Professional Makeup Artist and Stylist. Completed Training in Melbourne CBD with Elite Makeup Academy in advance Makeup artistry and Hair stylist.
Amongst my travels and learning Completed training in New York specialising in airbrushing, tattoo coverage with Kett Cosmetics.</td>
<td><img alt="" src="http://pictureperfect.kpwebservices.net/wp-content/uploads/2013/04/936482_507067716023365_1908922291_n.jpg" width="439" height="392" /></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
Your text has the CSS attribute vertical-align: baseline, which will cause the image next to it to line up with the base of the first row of text.
Try changing this to vertical-align: top.
If you use Firefox, you can quickly see this in action by using Tools -> Web Developer -> Inspector on your page and then clicking on the td with text in it.
You need a vertical align to make sure that no matter how much your height increases, the text in the left block remains on top. Use something like:
<tr>
<td style="vertical-align: top;">Our aim is to ensure you look and feel your best on your special day. Whether it is your;Wedding day, formal, Deb, SpringCarnival, photography and any occasion in between.<p></p>
<p>Picture Perfect Makeup is a mobile service catering Melbourne, surrounding and outer suburbs. We will come to your doorstep for your own comfort.</p>
<p>Mary Kechichian- Professional Makeup Artist and Stylist. Completed Training in Melbourne CBD with Elite Makeup Academy in advance Makeup artistry and Hair stylist.</p>
<p>Amongst my travels and learning Completed training in New York specialising in airbrushing, tattoo coverage with Kett Cosmetics.</p></td>
<td class="odd"><img alt="" src="http://pictureperfect.kpwebservices.net/wp-content/uploads/2013/04/936482_507067716023365_1908922291_n.jpg" width="439" height="392"></td>
</tr>
The style is in-line, however you can easily insert into a class and point the class to this cell. I would also suggest you put a margin on the image or padding into the cell where the image is located so that it looks much more elegant.
try replacing the table with this:
<div style="width: 86%; position:relative; margin:0 auto;">
<div style="width:50%; float: left;">Our aim is to ensure you look and feel your best on your special day. Whether it is your;Wedding day, formal, Deb, SpringCarnival, photography and any occasion in between.</p>
<p>Picture Perfect Makeup is a mobile service catering Melbourne, surrounding and outer suburbs. We will come to your doorstep for your own comfort.</p>
<p>Mary Kechichian- Professional Makeup Artist and Stylist. Completed Training in Melbourne CBD with Elite Makeup Academy in advance Makeup artistry and Hair stylist.</p>
<p>Amongst my travels and learning Completed training in New York specialising in airbrushing, tattoo coverage with Kett Cosmetics.</div>
<div style="width:50%; float:right;"><img alt="" src="http://pictureperfect.kpwebservices.net/wp-content/uploads/2013/04/936482_507067716023365_1908922291_n.jpg" style="width:100%; max-width:439px; height: auto;" /></div>
</div>
You should try to avoid using tables to layout your page and use them for, well tabular data.
Hope this helps

In outlook html email, float does not work

I want this layout where I have a rectangular box. And inside the box on the left there is a text and on the right there is an image. This looks fine in the browser, but when sent out as an html email, in outlook the float right doesn't seem to work. It puts the image in the next line under the text. Any ideas on how to make this work? (I am trying to avoid using tables.)
<div style="width: 100%;border-style:solid;overflow: hidden;">
<span style="float: left;">
<h3> Your appointment Details</h3>
</span>
<span style="float: right;">
<img src="someImage"/>
</span>
</div>
Very late to the conversation, but here is how to "float" in html email using align="" instead.
Example here
Also, if you are looking for resources on html email (I assume you are as the answer you marked correct is very general), here is a huge list of resources.
This is a really good guide from Mail Chimp on Coding for HTML Emails:
http://kb.mailchimp.com/article/how-to-code-html-emails
Some basic tips:
Use tables for layout.
Set your widest table to be maximum of 600px wide.
Don't try and use JavaScript or Flash
Don't use CSS in a style tag as some mail clients will discard it.
Use inline CSS styles only.
Basically code your emails as if it was roughly 2003.
CampaignMonitor provide this rather brilliant guide to all CSS support across multiple email clients, which is also available as a pdf or xls download.
As the answers above say, email support for CSS is very limited, mostly due to Microsoft's descision to use Word as its html rendering engine.
Simple floating images can be like
<img src="yourimage" align="left" />
BUT that way you won't get solid results with padding between text and image, outlook removes margin and padding and your text will stick right next to the image. So try this:
<div style="text-align:justify;">
...a lot of text here untill you want to insert an image that floats left...
<table cellpadding="0" cellspacing="0" align="left" style="float: left;">
<tr>
<td>
<img src="yourimage" align="left" vspace="4" />
</td>
<td width="15"> </td>
</tr>
</table>
...a lot more text here until you need an image that floats right...
<table cellpadding="0" cellspacing="0" align="right" style="float: right;">
<tr>
<td width="15"> </td>
<td>
<img src="yourimage" align="left" vspace="4" />
</td>
</tr>
</table>
... a lot more text here...
</div>
You need to wrap a 'table' element around it to get the padding-margin effect to work in Gmail, Outlook (online), Microsoft Outlook (desktop client),...
Give the table an align=left or right attribute. (Edit answer here: in addition and fallback for other email clients also give the table a float value so do both. They are back-ups to each other. Some clients understand "float", others understand "align", some understand both,...) Your table will float in the text almost like an image does. The only difference is that in outlook a table generates an automatic line break in the text where an image with align left or right does not generate breaks.
For setting the margin, since we are now working with a table, add an extra "td" with a width="15" to the left or right of your image cell and a non-breaking-space in it. (or a transparant gif -> spacer.gif)
You better not leave cells empty because otherwise the width of your cell will not be respected in certain email clients
For top and bottom margin we can use the 'vspace' attribute, don't forget to give the image an align = left or right attribute. Otherwise the 'vspace' will not work.
I've found a way to apply float on Outlook.com.
Just capitalize the tag like Float:left.
<span style="Float:left;">Content to float</span>
Maybe you should use !important too;
I tested it and it worked.
check out https://www.campaignmonitor.com/css/ here it has listed what are all the things supported and not supported in email
Instead of float you can use an outer table and put contents you want to float left in left td of outer table.
this is not an elegant answer but I did it this way
When you are floating something to the right of something the right floating element should allways apear first in code. Like this:
<div style="width: 100%;border-style:solid;overflow: hidden;">
<img src="someImage" style="float: right;"/>
<h3> Your appointment Details</h3>
</div>

text overlapping iframe

I have two iframes on a page and I can't figure out why the text is overlapping the second iframe. Any suggestions? Thanks!
<h1>Spanish Springs Library </h1>
<hr />
<div align="left" id="text" style="float: left;">
<div border="0" align="right" id="tour" style="float: right; width: 450px; height: 300px;"><iframe width="448" frameborder="0" src="http://tours.blackhawkvirtualmedia.com/public/vtour/full/55789" border="0" height="280"></iframe>
<div border="0" align="right" id="map" style="float: right; width: 200px; height: 200px;"><iframe scrolling="no" marginwidth="0" width="200" frameborder="0" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&oe=UTF8&msa=0&msid=108756021178700849594.000457097404325161dd5&ll=39.618251,-119.728832&spn=0.026447,0.034332&t=p&z=13&output=embed" marginheight="0" height="200"></iframe><br /><small>View a larger version of this map</small> </div>
</div>
<p>Calendar of Events<br />7100A Pyramid Lake Highway<br />Sparks, NV 89436 </p>
<p><strong><br />Hours:</strong> Mon, 10am - 6pm<br /> Tue - Wed, Noon - 8pm<br /> Thurs, 10am - 6pm<br /> Sun, 10am - 5pm <br /> Fri - Sat, Closed<br /><strong>Phone:</strong> 775-424-1800<br /><strong>FAX:</strong> 775-424-1840 </p>
<p>Spanish Springs Library is located on the Pyramid Highway in Spanish Springs. An octagonal building with open spaces set off by a 64 foot ceiling over the atrium, comfortable seating and thirty-nine public access/Internet computers, it is truly a destination for the entire family. Features include a drive-through service point to pick up and drop off materials, and a 24-hour book return. </p>
<p>The Nell J. Redfield Foundation Young People's Library features a unique oversized stack of books at the entrance and a separate Story Time room. Seven of the thirty-nine public computers (including an adult station so parents and children can work side by side, and two children’s games computers) and a family restroom complete the area as a family friendly place.</p>
<p>The teen zone is a comfortable place with eight of the thirty-nine public access computers and an area for group study and projects.</p>
<p>Programs for all ages are offered including Story Times, guest speakers and artists, craft programs, book discussion for all ages, an art gallery, displays, and much more!</p>
<p>An ADA computer station with a Braille printer is available to the public.</p>
<p>E.L. Cord community meeting rooms provide spaces for groups to meet and groups may arrange to stay after the library is closed.</p>
<p>Self-serve features include express check-out, the ability to pick up holds, Downloadable ebook and audio-book station, automated computer sign-ups, and printing. Offering wireless internet access and printing from your laptop, laptop locks, a public fax machine, a flatbed scanner for public use, and study rooms, the library is truly a destination for the whole family.</p>
<p>Citizens may request exam proctoring at the Spanish Springs Library. </p>
<p>The atmosphere is enhanced by the cozy fireplace, coffee cart and comfortable seating throughout the building.</p>
</div>
Your code is very confusing. Try to use only one tag <p> along the text and for the days/hours, use a <table>. If you can use a <div> and make the formatting of the text first and last place the <iframe> of Google Maps.

CSS Styling won't work in outlook 2010?

If I use styling in my outlook, it won't work.
how can I fix it? I am talking about this style code:
<div id="BodyID" Style=" word-spacing:2px; min-width:0px; min-height:0px;max-width:693px; max-height:490px; height:485px; background-color:#f4f4f4; border:1px solid #e4e4e4; font-family:Arial;">
Unfortunately Outlook supports something roughly equivalent to IE5 compatible HTML. It's really terrible. Here's a detailed MSDN article on the Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007, which I don't believe changed much for Outlook 2010.
Honestly, the only way I've been able to get outlook HTML to look the way I want is to hand generate the HTML using roughly HTML2 standard tags and properties and not using CSS at all. Some CSS renders, but it's really hit or miss.
Maybe this can help http://www.campaignmonitor.com/css/ It's a table, what is supported in E-Mails
edit
min|max-width|height not supported
http://htmlemailboilerplate.com/
I've been using that as a base for my HTML email campaigns.
And the link yunzen posted to campaign monitor is a great resource.
The MSDN article superlime linked to tells the sad story: for whatever incomprehensible reasons, Microsoft reverted nearly 10 years in their handling of HTML email w/Outlook2007, and did not see fit to fix it in 2010.
Having taken the trouble to design a well-formatted HTML layout for rest of the universe of mail user agents, I do see one saving workaround, which is what I'm going to direct my users to, rather than spend my time trying to reconstruct ancient HTML:
Use the VIEW IN BROWSER option Outlook offers for reading an email message. That re-assembles the HTML as intended.
Try adding 3 columns table, click on the example link below.
Example: Link
<table border="0" cellspacing="0" width="100%">
<tr>
<td></td>
<td width="400">
<table border="1" cellspacing="0" width="100%">
<tr>
<td>
Content here...
</td>
</tr>
</table>
</td>
<td></td>
</tr>
</table>

Resources