Mirage Design Works

IE List Item CSS Margin Hack

March 16th, 2008 by John Crenshaw

As a web designer you learn something new everyday about the intricacies of Internet Explorer’s faulty rendering of certain elements on a screen. While I’m not always a proponent of using a Strict Doctype, it does help solve some of those issues…then again, it also requires a bit more work and time is money, right? Well, one of the problems I’ve had with internet explorer in the past is the way it renders lists, unordered and ordered lists, especially IE6. Even with a Strict DOCTYPE declaration, internet explorer has a nasty little habit of adding margin between list items when you’ve specifically written into the CSS that it shouldn’t behave this way. I have to admit, I do this everyday and it took me a while to figure this out, so hopefully this will help someone else having margin problems with list items in IE 6 or any other version of internet explorer.

Internet Explorer List Item Margin Problem

So what is the problem exactly? Here’s a snapshot of the sidebar of a site I’m working on in Firefox:

Firefox sidebar list item margin

Incidentally, this is also how it appears in IE 7. Now, the snapshot of how that same unordered list appears in IE 6:

IE 6 List Item Margin CSS

Whoa! Where’d all that extra margin come from? Well, it certainly didn’t come from the CSS because every single other browser tested displays fine and all the margins are set to 0px, as well as padding. So what’s the problem here?

IE Problem with List Items and Display: Block

The problem rears its ugly head, in this situation, because I have the display property of those list items set to block in the stylesheet. Internet Explorer, but especially version 6, just freak out when trying to display lists when the links within those lists are styled display: block. So, how do we fix it? We need to trick internet explorer (because it’s bugginess also allows us to trick it into behaving the way we want) into thinking that the display property is set to inline, after we’ve done that we can essentially tell it we’ve changed our mind and we want the display property set to block. This will make IE really throw a temper tantrum, but it’s exactly the temper tantrum we want it to throw.

Conditional Comment Styles

To solve this we need to add a conditional comment in our header section, preferably near our other stylesheet declarations. This conditional comment is something only IE will read because, you guessed it, it’s psychotic:

<!--[if IE]>
<link rel=”stylesheet” type=”text/css” href=”http://yourdomain.com/styles/ie.css” />
<![endif]–>

Now you need to create a new stylesheet for Internet Explorer only and call it ie.css.

Once you’ve done that add these two lines to the stylesheet:

#sidebar li a{display:inline-block !important;}
#sidebar li a {display:block !important;}

The “#sidebar” part is part of my stylesheet because the sidebars on that particular site are wrapped in a <div id=”sidebar”></div>. When dealing with IE it’s alway best to be as specific as possible. Also, you’ll notice I’ve added the !important declaration to this. The purpose of that is to ensure that when I change some styles later on IE doesn’t go and try to ignore this rule. Generally, IE will adopt the most specific style, so, if I were to add the following line to my general stylesheet:

#sidebar ul li a{display: block; }

IE may try to ignore the hack above in the ie.css file. Why? Because this second declaration is more specific. The !important declaration prevents that.

So, now that we’ve added those two lines to ie.css, what does IE 6 show us?

Firefox sidebar list item margin

Ahhh, beautiful ain’t it?

Highlight Contents of a Text Box On Click

March 12th, 2008 by John Crenshaw

A project I was working on today for web design client in Los Angeles that involved a whole heck of a lot of form fields to run the admin backend of the website. I needed a quick and easy way to allow the client to change or delete everything in each field as quickly as possible. The best method is to highlight everything in the field using the onfocus() and select() javascript functions…

<input type="text" id="textfield" onfocus=”javascript: this.select();” />

Now isn’t that nice and simple? And the added usability is so great your clients will love you. You don’t have to tell them how little work it actually took ;)

Adobe Contribute CS3 Review

March 6th, 2008 by John Crenshaw

I just picked up a copy of Adobe Contribute on the recommendation of a friend of mine and, I have to say, it’s pretty incredible. I’m writing this post on my desktop, visually, in Adobe Contribute, and it’s showing up as I type exactly how it will be displayed when published…well, close enough anyway.

So far I’ve been able to edit posts and write new ones, but I haven’t figured out how to edit Wordpress pages yet…not sure if that’s possible, but I’ll keep you in the loop.

If you’re interested in taking a look at this time-saving piece of software, you can get a free 30-day trial from Adobe here.

I’m a huge fan of Adobe’s software. I’ve used almost all of their aplpications at some point in time, some more than others, and I’ve found everything to be so intuitive. For example, when I was installing Adobe Contribute, I had to add my server information so contribute could access this blog. At one point it asked for my blog’s access point. Now, I’ve been blogging for a while and designing blogs for just as long and I’ve never once heard the term “Access Point” in reference to a Wordpress blog. So I thought to myself, “What’s an access point?” No sooner had I thought that than I looked up and there in a little help bubble was the explanation of exactly what an access point was and how to find it.

That’s just a small example, but little things like that, when taken over the life of the software, save you so much time, headache, and money because you canfocus on the important tasks instead of searching endlessly online to figure out what a Wordpress “access point” is. That’s also why I’m zealously against Microsoft products. Even though I use Windows and Excel extensively, I avoid the rest like the plague because they are so unintuitive andbuggy I end up spending just as much debuggin and troubleshooting as I do creating whatever it is I’m creating.

I’ll write more about Contribute later, but I’ve been using it for about 20 minutes now and I’m so impressed I can’t believe it took me this long to start using it.

Tags: ,,,

Difference Between www and public_html Folders

March 4th, 2008 by John Crenshaw

Many small business website owners manage their websites themselves, and if you’ve spent any time on a web server, even with any of the easy-to-use administration utilities like cPanel, you’ll know that much of the functionality isn’t exactly self explanatory.

A client I’m working with currently asked what the difference was between the /www/ and the /public_html/ folders on her web server. The answer to that is nothing at all.

The /www/ folder was setup initially because people didn’t know what /public_html/ was and, when searching for a place to save website files, /www/ was more of an intuitive choice. In reality, the /www/ folder is nothing more than a shortcut to the /public_html/ folder. You can change, add, and remove files from the /www/ folder and everything will be reflected in the /public_html/ folder, and vice versa.

Problems Sending Email

February 4th, 2008 by John Crenshaw

I recently moved and was having problems sending email through this server. I could receive email fine, but for some reason, couldn’t send anything. I did some searching, finally contacted Lunarpages (my web host who I highly recommend by the way), and in typical Lunarpages fashion, they answered my question within 6 hours on a Sunday, and here’s what I was told…

If you are able to receive but not send, it’s not uncommon for an ISP to require their customers to use the information they provide for outgoing mail servers.

There is a list of known ISP’s here:
https://support.lunarpages.com/knowledge_bases/article/19

I just tested your server and was able to connect via SMTP without any issues. If you would like to test if your ISP is blocking external access to port 25 (SMTP) you can do the following:

In Windows** (Do not actually type the quotation marks):

Click Start -> Run
Enter “cmd” (”command” if your running Windows 98 or earlier).
When the new DOS prompt window comes up type in:
“telnet domain.com 25″ Then hit enter. (replace ‘domain.com’ with the actual name of your domain)

If your ISP is not blocking access you will see a message similar to the following:

220-yourserver.lunarpages.com ESMTP Exim 4.34 #1 Fri, 02 Jul 2004 13:20:48 -0700
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

This indicates that your computer is able to connect via SMTP. If you get a connection timeout or other error when using port 25, then you may have to use your ISP’s SMTP server in order to send outgoing emails. You may also want to try setting the SMTP port to 26, or 587 as alternatives.

I changed the port in my outgoing SMTP server settings to 587 and voila, problem solved.