Archive for the ‘Problems & Solutions’ Category

Overflow: Auto Problem / Bug In IE

Sunday, March 16th, 2008

Another quick bug fix for you. Another little quirk about Internet Explorer is the way in renders the overflow property. I’ve found two problems with this. First is that without a specified width, IE treats the overflow property, no matter how it’s set, as overflow: visible; Second, even after we’ve solved that problem, IE tends to cut off the bottom portion of the element if there is a scrollbar, as if it wasn’t taking the height of the scrollbar into account in its rendering, so let’s dive into these real quick.

First of all, if a width is not specified for the given element, IE will treat it like overflow: visible;, causing the element to continue outside of where you want it, like this:

IE Overflow Bug

In order to fix this you need to create a stylesheet just for IE (That’s explained in the last half of this article if you don’t know how to do that). Once you’ve done that, add the following styles to the IE-only stylesheet, where “.element” is the class of the element you’re working with:

.element { overflow-y: auto; overflow-x: visible; width: 450px; }

IE understands overflow-y and overflow-x, and the width is whatever width you want the element to be and it must be set to prevent this problem. In my case, I wanted the element to be as wide as the containing element, which was 450px.

Once you do this, you’ll notice this problem:

IE Overflow Bug pt 2

Ok, IE, you’ve really outdone yourself on stupidity this time. It looks like IE is not taking the scrollbar into account in the height of the element. So, now we need to fix that by adding padding-bottom: 20px; to the IE-only stylesheet, and here’s what we get:

.element { overflow-y: auto; overflow-x: visible; width: 450px; padding-bottom: 20px; }

IE Overflow bug pt 3

Voila! Problem solved. Keep in mind, this isn’t a perfect solution…the problem with this is that IE will add that 20px padding at the bottom of the element even if there isn’t a scrollbar, leaving you with some extra space on the bottom of your element in this case. It’s usually not a big deal, but if anyone knows of an easy fix for this I’m all ears.

IE List Item CSS Margin Hack

Sunday, March 16th, 2008

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?

Problems Sending Email

Monday, February 4th, 2008

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.