LEOPiC on September 1st, 2008

Google Chrome - Google’s Vision of a Browser

It seems that the cool kid on the block decided to give a it a shot when it comes down to browsers, the net was shock today when a comic strip took us by surprise announcing the spanking new (at least some of them) features of the Google Browser, this might be a great comeback for some people who claimed they (Google) had lost it’s mojo.

Tuesday, September 2nd will be the day when google will unveil their Weapon of Mass Destruction called Google Chrome based on the WebKit Open Source Engine (yes the same engine used by Safari and Dreamweaver CS4) with some of the Google magic built into it.

Can Google take down Microsoft? Will Google move the masses from Opera, Safari and Firefox into a single browser? Only time will tell my friends, only time will tell, for now we can only hope that the biggest search engine will plug their Browser without mercy.

Uncategorized No Comments

LEOPiC on August 22nd, 2008

Dealing with Flash’s “Z-Index”

This past week I was serving as the back-for our Front-End Engineer at a training in our company and one of the topics was dealing with Absolute and Relative Positioned Elements and one of the attendees asked me about working with Flash and how Flash always tried to get on top of all the content, well there is a simple solution and is given to us by Adobe themselves and it’s basically just setting a parameter in our movie and presto, it will work like a charm. Let’s see how this is done:

The HTML

<div id="wrapper">
  <div class="apDiv">
    <h2>testing oh my</h2>
  </div>
  <div id="flashMovie">
    <a href="http://www.adobe.com/go/getflashplayer">
      <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    </a>
  </div>
  <div class="apDiv">
    <h2>gosh</h2>
  </div>
  <div class="apDiv">
    <h2>3 times a charm</h2>
  </div>
</div>
</div>

The CSS

#wrapper {
	width:780px;
	margin:0 auto;
	border:1px solid blue;
	overflow:auto;
}
#wrapper #flashMovie {
	float:right;
	margin-top:-110px;
}
#wrapper .apDiv {
	width:280px;
	height:70px;
	background-color:#000;
	border:2px groove white;
	color:#00FF00;
	font-family:"Courier New", Courier, monospace;
	font-size:14px;
	position:relative;
	top:70px;
	left:150px;
	margin:10px;
	padding:10px;
}
 
#wrapper .apDiv h2 a {
	color:#FFFFFF;
}

The JavaScript

<script type="text/javascript" src="assets/js/swfobject.js"></script>
<script type="text/javascript">
			var flashvars = {};
			var params = {};
			params.wmode = "transparent";
			var attributes = {};
			swfobject.embedSWF("assets/swf/movie.swf", "flashMovie", "550", "400", "8.0.0", false, flashvars, params, attributes);
</script>

As you can see we are using our favourite method of inserting flash in our page SWFOBject, if you don’t want to use JavaScript to insert the SWF in your page, Stu Nicholls’ way, however we would use SWFObject for this demonstration.

Where is the magic? The WMODE parameter set to TRANSPARENT or OPAQUE will “send” the Flash Movie below our objects and get rid of the bug. If you don’t like to mess with code, you can check Adobe’s instructions on how to do it using only their tools.

I added the famous Suckerfish Dropdown menu from ALA to demonstrate you other possible uses and scenarios where this come handy, I won’t explain the code here, just give you a reference on who can help you.

Check a live sample of 3 divs along with the suckerfish dropdown being on top of a Flash movie.

Thanks to

Uncategorized No Comments

LEOPiC on August 14th, 2008

I have some good news and some bad news

I usually like to hear the bad news first so I can end up happy that something did not go as planned, so this is how it’s going to go down:

Bad News
The ECMAScript specification, as of this writing, has changed. In case you did not know, one of the key points when Adobe “sold us” AS3 is that it was compliant with the specification and that JavaScript 2 (which is coming soon to a user agent near you) will have the same base, thus making you intermediately familiar with both AS3 & JS2 at the same time (too good to be truth huh?).
So what does this mean? Well for one ActionScript (3) is isolated (again) and it’s separate and unique language (making it harder to digest and get familiar) that has it’s own set of rules. Will there be an ActionScript 4 coming due to this change? We’ll that’s up to Adobe to decide but a little rework seems logical.

The Good News
Apple, Adobe, Mozilla, Microsoft (you got that right), Opera & Google are working on a parallel specification on a project called ECMAScript Harmony on where they will try to achieve common ground for the future of JavaScript, let’s see what they come up with, so far you can check their advances in this document.

That can only mean less headaches and more uniform advances, great news people!

Taken from Web Monkey

Uncategorized 3 Comments

LEOPiC on August 13th, 2008

Guidelines to Develop Emails

In a prior post I talked about the CSS Support in email clients and promised to teach you how emails are developeed.

If you have been working on the net for a while just remember how we used to build websites before the glory days of CSS, nested tables font tags, spacer images, all those bad boys were our allies, we’ll emails are developed the same way.

Here are some considerations that you must have in mind at all times:

  • Don’t reference external stylesheets, they won’t be read by some of the major email clients
  • Don’t get too creative in terms of the layout, boxed is usually better
  • Don’t set widths and heights for columns, images, content and spacer gifs should take care of that
  • Always set the height & width of your images, this will help the browser to get render your layout correctly and fast
  • Would not recommend you to work with div (use tables, cells and spacers to create your structure) nor to declare a title or a doctype for your page as you won’t get much from them (if any).
  • A good rule of thumb is to always align your table cells to the top and the left this way, when you are aligning complex graphics you will know what you are facing
  • All the formatting for the text should go into font tags, you can use: style="font-size:10px" or any value you need for specific sizes.
  • Always use alt attributes for all your images, even if they are spacers, just set them blank like so: alt=" "
  • When trying to apply a background color for a cell or a table it’s better to create a 1px by 1px image with the solid color and then just tile it in the background like this background="bg_color_whatever.gif"

This is how our email will look like after it\'s ready.Ok so having that in mind I will show you the email we will develop (click to enlarge):
As you can see is not utterly complicated, it’s 2 column email, all the content will reside on the right, it has a header with the company name, a place for 4 stories (a main story and 3 secondary) and at the bottom we have a simple footer with some links and random information.
You can see it live at: Live Email Example

  • Email Outlining Tables

    This is how the email looks like when you outline all the tables.

  • Email Outlining Cells

    This is how the email look when table cells (td) are outlined).

  • Email Outline Images

    This is how the email will look like when you outline all the images.

As you can see images take a decisive role in emails as they give us space, height and width for our content.

Update: I just stumbled across this great article at another Web Development blog, good stuff on it, worth a read.


Big thanks to Cesar Nuñez, Web Developer for the Email Team at avVenta for all of his corrections and recommendations.

Uncategorized No Comments

LEOPiC on July 29th, 2008

CSS Level 2.1 Selector Experiments

Selectors

The last few days I’ve been poking around selectors and doing some demonstrations on what can be done minimizing ID’s and Classes (which is always an ultimate goal for all of my projects) and run into some pleasant (and some not so much) surprises.

The challenge

Style three instances of the same tag with the same content, without using IDs or Classes or any other special identifier.

The Code

The XHTML is pretty straightforward, just 3 ‹p› tags with dummy content on them

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer nis.
Nullam quam. Nunc dictum dui ac mauris. In fringilla, leo eu tempus eleifend,
tellus tellus consequat tortor, ac pulvinar turpis neque ut velit. Mauris
rhoncus odio vel justo. Phasellus non sapien et est pulvinar molestie. In
eu nisl eu ipsum convallis auctor.</p>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer nis.
Nullam quam. Nunc dictum dui ac mauris. In fringilla, leo eu tempus eleifend,
tellus tellus consequat tortor, ac pulvinar turpis neque ut velit. Mauris
rhoncus odio vel justo. Phasellus non sapien et est pulvinar molestie. In
eu nisl eu ipsum convallis auctor.</p>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer nis.
Nullam quam. Nunc dictum dui ac mauris. In fringilla, leo eu tempus eleifend,
tellus tellus consequat tortor, ac pulvinar turpis neque ut velit. Mauris
rhoncus odio vel justo. Phasellus non sapien et est pulvinar molestie. In
eu nisl eu ipsum convallis auctor.</p>

Check out how this page looks far.

The CSS is a little bit tricky, but nothing to fear :), let’s take a look:

/* pseudo global reset */
* { margin:0; padding:0;}
/* some global rules for all paragraphs, just some breathing space */
p {
	padding:2px;
	margin:5px;
}
/* we will tackle the first paragraph here */
p:first-child {
	width:30%;
	color:#666666;
	font-size:16px;
	line-height:160%;
	color:navy;
	font-family:Georgia, "Times New Roman", Times, serif;
}
/* the first letter of the first paragraph */
p:first-child:first-letter {
	color:blue;
	font-size:32px;
	float:left;
	margin:3px 5px 0 0;
	font-family:Georgia, "Times New Roman", Times, serif;
}
/* now we'll tackle the second paragraph */
p + p {
	border:1px solid #CCCCCC;
	width:35%;
	font-family:"Courier New", Courier, monospace;
	border-bottom:2px solid #999999;
	border-right:2px solid #999999;
	line-height:140%;
	font-size:14px;
	padding:5px;
}
/* and now the last paragraph */
p + p + p {
	border:2px solid red;
	width:30%;
	text-transform:uppercase;
	font-size:120%;
	font-size:12px;
}
/* how about sharing the same rule for all of the 3 paragraphs? */
p:first-child, p+p, p+p+p {
	float:left;
}
/* sort of experimental rule, not included in
   the CSS2.1 recommendation, currently IE7 does
   not support it, however Firefox2+, Safari3+ do */
p:last-child {
	font-family:Arial, Helvetica, sans-serif;
	font-size:9px;
	color:red;
	float:right;
}

Check out the result here

The Result

We succesfully tackled the three paragraphs without using a single identifier, isn’t awesome?! Well, sort of awesome. Not every browser supports all of the selectors we used, but let’s positive and start off with the proof: (click on each image to view a larger version)

  • Correct Rendering

    Well that looks pretty f’n good, does not it? Firefox 2 manages to digest all of our rules, even the p:last-child one. Let’s go to

  • Correct Rendering

    Well, it’s 2 out of 2 so far, Safari does a great job too! Let’s go with

  • Selectors Test in IE7, Windows Vista

    Well IE7 makes a decent job rendering our test, it’s just missing the p:last-child, but for now we can live without that one.

  • Selectors Test in DreamWeaver8

    Well I know DW might not be relevant at all when it comes to rendering, but hey, it’s good to know that it gets some of the stuff right

  • Selectors Test in IE6, Windows XP

    Well I wish we could all go to bed happy knowing that we got new tools under our Web Dev belt to use in our next project, but hey, there is still something missing, right? Well this is not case (at least not for all of us), IE6 rears it’s ugly head and give us NO love at all for our CSS trickery, come on, we knew this was going to happen from the beggining did not we?

The Veredict

Selectors are a powerful CSS tool that is only getting better and better, I recommend you to take a look at the selectors being worked on for the current CSS3 Draft as they are quite appealing and a little bit easier to digest too.

CSS and HTML / XHTML No Comments

LEOPiC on July 20th, 2008

CSS Support in Email Clients

I just stumbled across a very handy link that talks about CSS do’s and dont’s when developing emails, worth taking a look.

As you may (or may not) know when developing emails there are a lot of restrictions and considerations that must be taken and certain rules must be followed.

Examples of this are:

  • Emails are developing using tables a good old spacer images in order to achieve consistency through all email clients
  • CSS Support is very limited and rather disencouraged as not all of the clients have the same set of rules for CSS.
  • Semantic in emails it’s just a unrealistic dream
  • Same goes for accesibility
  • Javascript o_O ?

I’ll try to put together an email next week and post it here so you guys can see what I’m talking about.

CSS and HTML / XHTML 1 Comment

LEOPiC on July 13th, 2008

My Web Development Toolbox

A few people asked me the other day, which tools I used at work, this is software I recommend and that I’ve been using for a while now and has made my life easier, we’ll begin with:

  • Browsers
    • Firefox: one of the best browsers available, fast, reliable and standards compliant, regularly use version 3 and use version 2 for testing purposes.
      • Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, XHTML, and JavaScript live in any web page.
      • Web Developer Toolbar adds a menu and a toolbar with various web developer tools.
      • JS View: lists and displays all the external JS & CSS files in a site
      • Measure It: draw a ruler across any webpage to check the width, height, or alignment of page elements in pixels.
      • WAVE Toolbar: provides a mechanism for running WAVE reports directly within Firefox. It’s a great way to check accesibility right in the browser.
      • PixelPerfectPlugin: one of the greatest (and hardest) commitments to customers (when doing Front-End Development) is to match their visual references or compositions as close as possible, called Pixel Perfect Implementations, this great a new extension makes it easier by putting your visual reference on TOP of your developed XHTML.
      • Clear Cache Button: need an explanation, super handy.
      • CookieSafe: need to debug and are worried that somethings are not working right, well disable your cookies you might be storing something that it’s dragging you.
    • Safari: another great browser now it’s even easier to check pages in Safari due to the fact that starting with the beta release of version 3.0 it’s available for PC.
    • Internet Explorer:
      • Internet Explorer 6 (via VMWare): now there are a few ways when it comes to emulate IE6, if you have Vista it gets even harder as it’s virtually imposible to install IE6 on it, what is the only way to have a real and totally native version of IE6 running on your machine? Get a Virtual Machine and install WinXP (or anything in between).
      • Internet Explorer 7 : not really my choice of a browser, but it’s nice to have it around to be able to check any issues that might arise.
      • Now for both versions of IE there is tool that mimics Firebug that can come handy, it’s called the Developer Toolbar and it’s always nice to have around.
    • The rest :
      • Charles: HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information). It’s handy when you are working with tracking and stuff like that (yes I know Firebug can check it too, but this is easier).
      • BrowserShots: screenshots from several browsers and OS combinations, for free!

CSS and HTML / XHTML and geek No Comments

LEOPiC on July 12th, 2008

list-style:none;

Working with lists can be a real semantic pain if we are not sure of what we are doing or why we are doing it, we are going to quickly go through them and share some best practices.

Ordered Lists (ol)
These are the ones you are looking for when you need a list with special importance or a list of elements that need to be grouped and numbered such as my favourite movies:

<ol>
	<li>Big Fish</li>
	<li>Philadelphia</li>
	<li>NBX</li>
</ol>

Will display

  1. Big Fish
  2. Philadelphia
  3. NBX

So basically what we got is a list of items ordered by numbers (this can be easily changed into roman markers, greek markers, alphabetic markers and more) so we got the first list out of the way, remember to use it when you are listing elements that need a specific order.

Unordered Lists (ul)
These are by far the more common type of lists, they are to be used for navigations, grocery lists, footnotes and any other group of common information that need to be listed or arranged, let’s look at the example of a grocery shopping list

<ul>
	<li>Apples</li>
	<li>Tomatoes</li>
	<li>Beer</li>
</ul>

Will display

  • Apples
  • Tomatoes
  • Beer

Now we begin to see a pattern right?, all the elements inside these two lists are inside li tags, however the container is the one that changes from UL to OL and that is what makes the difference between each list.

There is one more type of list called the Definition List that deffers from what we’ve seen here so for now and to keep this post from total boredom, I’ll just reffer you to someone who knows a little bit about them.

Okay so the whole purpose of this entry is not to repeat what’s on the W3C Specification but rather to give you some tips while working with lists.

The rare IE (six and seven) bullet position bug
Now this happened to me and to a coworker in a week span so I think that makes safe for us to say that can happen to you, specially when you are working over someone else’s code and have no idea where things are or how they were made.

So what is this bug all about? Let’s take a look:
Example of any given UL or OL type of list Well basically the regular bullets in ul will always sit in the first line of the LI at the top right, however for some reason sometimes IE’s rendering engine will display them at the bottom LEFT of the li, so it will place them at the top left of the last line.

How to get around this? Well a simple image can do the trick, just use a image that mimics your bullet, get rid of the bullet in your list and position it using CSS, something like these:

ul {
    list-style:none;
}
 
ul li {
    background:url(urlToYourBullet.gif) 6px left no-repeat;
    padding:0 0 0 9px;
}

So this will place the bullet of your choice 6px from the top and at the left and mimic the bullet, now remember to give some padding at the left of your li so you don’t go over the image :).

Presto, this is all you need to get rid of that annoying bug and always have maximum control of your lists.

CSS and HTML / XHTML 2 Comments

LEOPiC on July 11th, 2008

Working Transparent 24bits PNGs in IE6

Unlike most people I won’t go on with a post of how I just created the ultimate method for using transparencies on 24bits PNGs in IE6 I will tell you what works for me:

The problem
IE6 does not properly handle transparencies on PNGs at 24bits, it usually shows a gray/turquoise area where the transparency should go which makes them pretty much obsolete in Web Development if they are not used correctly.

The Solution
There are many ways to go around this problem, last night while working for the brand new Fuel Economy Sitelet for Buick I needed to have a transparent PNG sitting on the page so basically it went a little bit like these:
The CSS

#pngContainer{
	width:345px;
	height:53px;
	background:url('../button.png') top left no-repeat;
}
 
* html #pngContainer{
    background:none;
	filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/root/button.png', sizingMethod='crop');
}

The HTML

  <div id="pngContainer">
    <p>Content goes here</p>
  </div>

So basically what we are doing is setting the PNG as the background of this container and then using a hack for IE6 removing it and then setting it again with the proprietary filter property, sounds simple right? Well it is, just like that you will have a transparent PNG as the background of your container :), full 24bits madness all over you!

Okay so we got that out of the way, but what happens when you NEED a 24 bits PNG to be in a LINK tag?, well for some reason using the good old display:block won’t work in IE6 so there is also a way around that, let’s see it:
The CSS

#pngContainer a {
	display:block;
	width:345px;
	height:53px;
	cursor:hand;
	_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/root/button.png');
}
 
#pngContainer a img {
	width:345px;
	height:53px;
	cursor:hand;
	_filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
}

The HTML

<div id="pngContainer">
   <a href="#yourLinkWillGoHere">
      <img src="../images/imageRouteGoesHere.png" />
   </a>
</div>

So basically what we are doing here is relying again on the Microsoft Alpha Loader filter and the Opacity filter, so basically we are putting the image as background for our container using the underscore hack for IE6 only and then inserting it into the a tag for the rest of browsers and then, the final step is to hide it from IE6 using the Opacity filter :), sounds like fun right?

Well it is no fun at all, but it works, so there you go, have a nice weekend.

Important you have to know that the paths used in the filter must be absolute to where the HTML is.

CSS and HTML / XHTML No Comments

LEOPiC on July 2nd, 2008

CSS Variables

I just read over at monkey_bits that The WebKit Open Source Project (which in case you don’t know is the core behind Safari) are experimenting with CSS Variables which to some sorts is like using low-level programming to make our life easier or at least more streamlined.

This is how we work now:

1
body, p, table { color:#F00; background-color:#FFF; }

This is an example of what we could do with simple CSS Variables:

1
2
3
4
/* this is where we set our values */
@variables { defaultTextColor: #F00; defaultBgColor: #FFF; }
/* the magic kicks in */
body, p, table { color:var(defaultTextColor); background-color:var(defaultBgColor); }

Now if you look at the code, you might seem that the version with variables takes up one more line, however and that this might be avoided by just setting a global declaration like

1
body {color:#F00; background-color:#FFF; }

However this is a more viable and understandable way of doing it, as we could set say max 4 o 5 colors to be used for the whole site and don’t have to remember their HEX Codes nor their specific values and simply reference the variable. I am still not 100% sold on the idea, mainly because as most things with Safari and mainly Webkit, is not usable until IE6 is deprecated and Microsoft implements this in their browsers.

CSS No Comments