Ironpaper Webintel: Knowledge base for internet business and web development.
Topic:

css

Creating HTML emails and newsletters

Sunday, December 5th, 2010

Creating and designing HTML emails and newsletters can be quite a frustrating experience.  Perhaps the largest problem with HTML email design is the broad range of devices and software which render and read email  messages from Outlook, Mac Mail, to free email clients like Hotmail and even mobile devices (each of which render email differently). Achieving cross-browser capability for email is a daunting task to say the least. Even after you get the basics figured out and gain a generally acceptable experience across a broad range of clients, you still need to consider the widths at which different clients and readers display your HTML newsletter design. To add to the frustrations, as many mail client providers have increased the support for HTML within email, Microsoft has sadly gone backwards and introduced less capabilities for rendering HTML email.

Two common ways of creating an HTML email or newsletter:

  1. Coding by hand (our recommendation because it gives you the most control and ability to troubleshoot)
  2. An existing email template plus the use of a WYSIWYG editor (less precision and control)

Two common methods for coding them:

  • Use HTML tables to create the structure and general layout (pure CSS web development does not work entirely for the email world, because the definitions and coding may be stripped out or ignored by the various clients
  • Use inline CSS to create both the structure and you can use it for styling elements throughout your presentation or design

Some things to remember ( here are a few no, nos):

  • Do not use CSS shorthand like "font: 14px/16px"
  • If you use CSS style declarations, you must not place them in the <head> tag
  • HTML tables should do most of the layout work: DIV and SPAN can be used, but tables are better for layout
  • Keep CSS inline

CSS3 Rounded Corners: Border Radius Example

Thursday, September 9th, 2010

Here is a simple example of using CSS to create rounded corners. This CSS property is not full supported by Internet Explorer, but more contemporary browsers do support this property.

Here is a simple example of how to employ CSS rounded corners:

.my_css_class {
-moz-box-shadow: 3px 3px 3px 3px #000;
-webkit-box-shadow: 3px 3px 3px 3px #000;
box-shadow: 3px 3px 3px 3px #000;
}

CSS3 (Opera browser) Mozilla equivalent WebKit equivalent
border-top-right-radius -moz-border-radius-topright -webkit-border-top-right-radius
border-bottom-right-radius -moz-border-radius-bottomright -webkit-border-bottom-right-radius
border-bottom-left-radius -moz-border-radius-bottomleft -webkit-border-bottom-left-radius
border-top-left-radius -moz-border-radius-topleft -webkit-border-top-left-radius
border-radius -moz-border-radius -webkit-border-radius

Assign Two CSS Classes Together For One Object

Thursday, July 8th, 2010

It is possible to assign an object two or more classes at the same time. WordPress does this out of the box for images, for example.

<img class="alignnone size-full wp-image-144"

We used color coding of each class to detail each class applied to the image tag. To add multiple classes, simply separate each class with a space (not a comma). In the case above, the image will use the rules for both "alignnone" and "size-full" as well as "wp-image-144."

This can be useful if you are using a CSS grid framework or if you have created your own CSS primer style sheet, which requires further customization. It will allow you to leave the framework untouched, while you can add further specifications or style to the second class. This way, classes can be re-used and recycled.

HTML 5 @font-face Font Format Usage

Saturday, June 5th, 2010

font html5 directory of options for web design that are open sourceHTML 5 brings a lot of new and exciting features to the web design community. Web design blogs have been filled with discussions of the HTML 5 support for native web video. A lot of other features however deserve your attention as well, such as the canvas elements, CSS 3 transitions and font support.

Font support will greatly enhance the look and feel of the web--as the former constraints of a limited palette of typography choices are lifted.

With HTML5, designers will be able to use a font that is not present on the viewer's machine--yet still display the font. Font products that support the WOFF font format will be able to be used on a web page as real text. The declaration @font-face will allow for the display of new typography options on the web.

WOFF is not the first technology of it's kind that allows for the download of  new typography options for the web. WOFF will be the preferred way to display new fonts.

Below: Here is an example usage of @font-face within CSS:

@font-face {
font-family: 'BL Avenir Black';
src: url('fonts/BLAvenirBlack-webfont.eot');
src: local(' '),
url('fonts/BLAvenirBlack-webfont.woff') format('woff'),
url('fonts/BLAvenirBlack-webfont) format('truetype'),
url('fonts/BLAvenirBlack-webfont.svg#webfont') format('svg');
}

Using double declarations: one for Internet Explorer and one for the rest:

@font-face {
font-family: 'BL Avenir Black';
src: url('/font-folder/arial_black-webfont.eot');
}
@font-face {
font-family: 'BL Avenir Black';
src: url('/font-folder/arial_black-webfont.woff');
}

Notice that the font is stored on the server and the path is specified so the user system can reference the font file formats. In the definition above, we are referencing Paul Irish's Bulletproof @font-face syntax, which, for example, provides an .eot font for Internet Explorer and backup formats in .ttf and .otf. There are a number of others out there that have published helpful articles on bulletproofing @font-face as well, to name a few: Mark Pilgrim and Jonathan Snook.

Using conditional statements for @font-face for Internet Explorer can make such an ugly and wasteful mess. Instead, you can use double declarations to provide IE with the .eot font format. Currently, only Firefox is supporting WOFF font formats--other browsers plan to in future releases.

Great reference for @font-face

If you want to learn more about HTML5 and fonts, we recommend taking a look at Paul Irish's: Bulletproof @font-face syntax:http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/. Paul Irish does a great job of breaking down the concept and demonstrating real world and helpful examples.

@font-face easy generator

Another recommendation that we can make would be to use the fontsquirrel.com for fonts that you have the right to use. This very helpful tool can create a small toolkit for web developers and designers to convert fonts into WOFF or EOT formats. Take a look: http://www.fontsquirrel.com/fontface/generator

Turn Your Chrome Browser Into A Free Web Developer Toobox

Thursday, May 27th, 2010

Use Google Chrome to turn your browser into a web development toolbox. There is a broad range of tools that can allow you to bypass the expensive Adobe Web Standard suite of software and load up your web browser with some pretty hot tools for web design. Granted, this can also be done with Mozilla's Firefox web browser, but for now we will focus on Google's Chrome browser.

To start, explore the extensions marketplace for Google Chrome at chrome.google.com/extensions/featured/web_dev. If you make it to the extensions homepage, from the left hand menu select the FEATURED > WEB DEVELOPMENT option to find the available tools.

https://chrome.google.com/extensions/featured/web_dev

There is a mini arsenal of great tools designed for the Chrome Browser to be had from this marketplace. This is a fantastic alternative to high-end software options for the Mac and PC. This could be a godsend for small businesses trying to get off the ground but coping with the challenges of  growing pains and software licenses for web design. One of the great aspects of this approach is that you can basically build a web development workbench within about a half hour simply by installing some free  add-ons to your web browser.

Here are a few recommendations:


Editor
Easily edit HTML right inside your web browser. It provides a quite handy grouping of code tags and a wide text field that displays above your page.


Picnik
Capture web pages and edit images within your web browser using this great application, Picnik. For simple image editing tasks, this is a very speedy and efficient alternative to using Photoshop or Fireworks.


Web Developer
Adds a toolbar button with various web developer tools very similar to the Firefox Web Developer extension. It has some quite handy gadgets, including a CSS panel, Forms panel and a wide variety of image focused functions such as "find broken images."

There are a great many for nifty tools, such as:

  • CSS Reloader
  • A JavaScript Tester
  • PHP Documentation
  • JSonView
  • A validity icon in the address bar allowing you quick access using  Ctrl+Alt+V to validate the current page.

Crash Course In CSS Conditional Statements For Internet Explorer – IF IE

Sunday, May 23rd, 2010

For web designers, Internet Explorer is a true pain in the butt. This article gives web designers a weapon to combat the various rendering engines for the Internet Explorer browsers whether 5.5, 6, 7, or 8. Since Internet Explorer does not conform to web standards that other browsers, such as Mozilla's Firefox has tried to maintain, designers have had to resort to all kinds of hacks and duplications to make web pages appear the same across different web browsers.

There is a simple technique for executing code in Internet Explorer only, which can be a great last line of defense for cross browser compatibility in web design.

Firstly, there are two types of conditions that will be generally helpful to a web designer. One is positive, which means "if a condition is TRUE, then do this...". The other is negative, which means "if a condition is FALSE, then do this...".

Positive Condition
<!--[if condition]> HTML <![endif]-->
Negative Condition
<!--[if !condition]><![IGNORE[--><![IGNORE[]]> HTML <!--<![endif]-->

Here are a few types of conditions that you can use.

IE
Any version of IE
if lt IE
(insert version)
Versions less than the version specified in (insert version) for example if lt IE 6
lte IE (insert version)
Versions  less than or equal to version specified
IE (insert version)
Only version specified
gte IE (insert version)
Versions greater than or equal to version specified
gt IE (insert version)
Versions greater than the version of IE that you specified

In brief:
So basically, you can use this downlevel-hidden conditional comment to reveal something only in a specified version of Internet Explorer.

<!--[if IE 8]>
<p>This is Internet Explorer 8.</p>
<![endif]-->

Using IF IE Conditional Statements For Style Sheets

You can also use "If IE" conditional statements to reference (link to) style sheets for only Internet Explorer. Other web browsers such as Safari, Mozilla's Firefox and Opera will not reference the style sheet used in the conditional statement. This is a very common IE hack used by web designers to fix weird issues with spacing, margins, padding and other problems with pages rendered by IE.

Example:

<head>
<title>Test Page</title>
<link href="all-browsers.css" rel="stylesheet" type="text/css">
<!--[if IE]> <link href="only-ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<!--[if lt IE 7]> <link href="ie-6-and-lower.css" rel="stylesheet" type="text/css"> <![endif]-->
<!--[if !lt IE 7]><![IGNORE[--><![IGNORE[]]> <link href="notie7.css" rel="stylesheet" type="text/css"> <!--<![endif]-->
<!--[if !IE]>--> <link href="not-ie.css" rel="stylesheet" type="text/css"> <!--<![endif]-->
</head>

Conditional Operators

! [if !IE] - The NOT operator.
lt [if lt IE 5.5] - The less-than operator.
lte [if lte IE 6] - The less-than or equal operator.
gt [if gt IE 5] - The greater-than operator.
gte [if gte IE 7] - The greater-than or equal operator.
( ) [if !(IE 7)] - Subexpression operators.
& [if (gt IE 5)&(lt IE 7)] - The AND operator. Returns true if all subexpressions evaluate to true
| [if (IE 6)|(IE 7)] - The OR operator.

Design Styles For Web Form Input Fields

Wednesday, May 12th, 2010

Forms can be a very important part of a website as often are a gateway in the conversion funnel. Web designers are finding very interesting and often subtle ways to make forms less painful and, at times, more appealing. Forms should not be confusing or overly cluttered. Also, it is important that forms have visual appeal to make the process of entering (or sharing) information more graceful and easier. This article will cover some interesting form design options for the input field. This will be less a "how to" than an aesthetic assembly. Below are some unstyled or minimally styled forms. ( Internet Explorer 6 default input form style. )

Now, below are some examples of Internet Explorer rendered form fields <textarea>, but with some style treatments. For example, changing the background color can a be a simple transformation to a default <textarea> or <input>.

input { background-color: #cccccc; }

Above, the HTML for changing an input field's background color to a light gray. More styles: There are a number of form elements that you can manipulate to better integrate HTML forms into your overall aesthetic direction. These elements will be a good place to start for designing a web form:

<form> <input> <select> <textarea> <label>

From providing borders to background images and background colors, forms can undergo some quite elegant transformations using beginner and intermediate level CSS. Contemporary Input Field Styles Below are some more contemporary implementations of web form input fields ( and buttons ).

The very famous Apple text input field. A small "finder" icon sits to the left of the input area. The graphic simplicity of this design makes many Apple fans feel like their products are more "intuitive." Below the first Apple input field is an activated (selected) field that displays a blue glow effect to demonstrate that this is an interactive object and it is in the process of an action / engagement with the user.

Google recently underwent a design update that changed the look and feel of it's field input area and search button. There was debate during the design process that the button would contain a deep blue background color to which many Google testers during the "dogfooding" process felt that it was a distraction away from the paid search ads that are Google's bread and butter. This softer and more integrated button became the winning element. This approach involves nesting the button within the search field so as to make the two elements (field and button) appear as one integrated unit. Also such nuances may seem trivial to most users of the web, for Google such decisions can directly impact their bottom line. Google's goal is to reduce the clutter and confusion of a web search and reduce the time it takes for a user to click on a result or ad. This hyper minimalist / efficiency driven approach has made Google millions, and the results of subtle design changes can be tested an segments of users before they roll out the final approach. Yet some have criticized this design process of testing, testing and more testing as lacking innovation and true creativity.

Twitter has been long praised for a sense of interesting and engaging web design. Here it takes a similar approach to encapsulating the button with the input field to make a single form object. The input and trigger (form and button) are simplified into a single action item that feels both cute and friendly, at the same time. Rounded edges help give form items more personality and a sense of ease or comfort--besides just simply being nice to look at.

Above are three other common approaches within contemporary web design for creating a sense of "ease of use" and friendliness. Two of the above examples use background images (background-image: url();) to give a very subtle treatment to the input field. Such approaches can use a repeatable image or one larger image whose edges will not be reaches as they extend beyond the confines of the field (in the background).  The third option uses more of a "simple design" approach which has a certain cute factor but also improves usability through clear, easy to read large font and padding between field edge and internal content. Note: the hightlight is caused at the OS level by Apple, but not a product of the form CSS.

Here is the code used to create the (above) third example (of the last three). The CSS in this demo is embedded, but if you were to recycle this CSS for use in other fields with a uniform application, it would be recommended to create a class for the CSS instructions.

<div style="margin: 10px 20px 10px 20px;">
<input style="padding: 5px; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 16px; color: #666;" />
</div>

Styles Dropdown Not Showing Mailchimp WYSIWYG Editor? Mailchimp Custom Newsletter Template Design Help With Titles.

Wednesday, April 28th, 2010

Help defining TITLE and SUBTITLE attributes for Mailchimp custom template WYSIWYG editor STYLE dropdown

We had a few people write in to us and ask how to work with custom Mailchimp templates. Specifically these web designers were having trouble getting the "TITLE" and "SUBTITLE" attributes to show up in the "Styles" drop down within the WYSIWYG editor after creating or modifying a custom HTML newsletter template. Instead of these designers being able to access the TITLE and SUBTITLE attributes from the Styles drop down in the content editor, they can only see "default text" as a selectable option.

The above image shows the Style drop down menu after it has been properly populated with additional attributes. The FCK Editor defines these attributes outside of the embedded CSS that the web designer declares within the newsletter.

SOLUTION:

You will need to define the main editable content area by using mc:edit="main" and not "content", which was the approach used within a number of the free downloadable starter templates found within the Mailchimp website. In addition, you will need to ensure that you are using .title and .subTitle ( class="title" and class="subTitle" ) ( and NOT .primary-heading / .secondary-heading /.content-title / .content-header or another option). By specifying .title and .subTitle you will be able to define and access those styles from the WYSIWYG editor Styles menu. Please note: If choosing "Default text", the text gets surrounded of a span tag without any class.

Below is a sample CSS declaration for those two classes:

.title {
/*@editable*/ font-size: 16px;
/*@editable*/ font-weight: bold;
/*@editable*/ color: #000000;
/*@editable*/ font-family: Arial;
/*@editable*/ line-height: 150%;
/*@editable*/ margin: 25px 0 0 0;
}

/**
* @tab Body
* @section subtitle style
* @tip This is the byline text that appears immediately underneath your titles/headlines.
* @theme subtitle
*/
.subTitle {
/*@editable*/ font-size: 12px;
/*@editable*/ font-weight: bold;
/*@editable*/ color: #000000;
/*@editable*/ font-style: normal;
/*@editable*/ font-family: Arial;
/*@editable*/ margin: 15px 0 15px 0;
/*@editable*/ line-height: 150%;
}

Need help? Let us build an eNewsletter design template