A Cake For Firefox

Cake For FirefoxFirefox recently released Firefox 2.0. There was a little slip-up with that release though, it hit some FTP servers earlier than it should have.

Anyway, the Internet Explorer team at Microsoft sent a cake to the Firefox team, congratulating them on their release of Firefox 2.0. Pretty weird huh? One would expect the cake to be full of poison, but that’s not the case. It’s simply a “job well done” present from the IE dev team to the Firefox guys.

It’s nice to see archenemies sending such nice gifts, even if it is Microsoft that’s involved. Can you feel the love?

0

CSS Changes For IE7

The Internet Explorer development team has posted a list of CSS changes made in Internet Explorer 7. There’s lot of good ones, lots. My favorite of all of them is PNG transparency. Transparent PNG’s will now show up correctly in Internet Explorer! yay!!

Other major changes include :hover for all elements and the implementation of position:fixed. Super. Welcome to the 21st century Internet Explorer.

0

Wrapping Text Inside Pre Tags

I sometimes display little snippets of code on this site. For example, here, here, and here. To do this, I use the Code Markup wordpress plugin.

If you’re using Firefox, you may notice the long lines in my Digg Integrator fix post. It’s not really a problem for me having those really long lines in Firefox. Why? Because Firefox still displays my sidebar correctly. Internet Explorer is a totally different story though. When there’s long lines like that, my sidebar will appear at the very bottom of the page in IE.

The long lines are caused by use of the pre html tag. The pre tag preserves spaces and line breaks in a chunk of text. Perfect for displaying snippets of code. However, some lines of code are quite long and will run off the page. This is exactly why my sidebar was getting pushed to the bottom of the page in IE.

So, I set out looking for a method to wrap text contained within pre tags. Google found exactly what I was looking for. Wrapping text inside pre tags is quite easy, all that’s required is a simple addition to your css:

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

Quite simple. After adding that CSS, the text in pre tags still doesn’t wrap in Firefox, but I don’t care because Firefox displays the rest of my page as it should. Now, when you view a page in IE with a long line, the text is wrapped and my sidebar content appears at the top of the page instead of the bottom.

For consistency sake, let’s make these long lines wrap in Firefox too. This is extremely simple. It only requires adding a few characters to the CSS shown above. For text wrapping in Firefox, use this CSS:

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}


Notice the only difference between the first and second examples is the addition of “!important” to the third line in example 2. After adding that little bit, your text between your pre tags should wrap well in basically every browser that’s currently in use.

UPDATE 3/10/2007

If you can’t seem to get the css above to work, give the css below a shot. I just set a width on the pre tag. When the width is set to 100%, you’ll get a horizontal scrollbar when viewing in IE7. That’s why I’ve set the width to 99%. The code will display just fine in IE6, IE6, and FireFox when width is set to 99%. I have not tested Opera. Try this updated CSS if you’re having issues with the original CSS from above.

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
 width: 99%;
}

UPDATE 6/4/2008

Markku Laine posted some css in a comment that seems to work better than the original css I posted. It works in IE, Safari, and FireFox. Try using Markku’s css below if the previous examples don’t work for you.

pre {
 overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
 white-space: pre-wrap; /* css-3 */
 white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
 white-space: -pre-wrap; /* Opera 4-6 */
 white-space: -o-pre-wrap; /* Opera 7 */
 /* width: 99%; */
 word-wrap: break-word; /* Internet Explorer 5.5+ */
}

Update 1/20/2011

Some code Max posted in a comment also seems to be working well for many people. It may be worth trying as well:

height: 120px;
overflow: auto;
font-family: “Consolas”,monospace;
font-size: 9pt;
text-align:left;
background-color: #FCF7EC;
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
margin: 0px 0px 0px 0px;
padding:5px 5px 3px 5px;
white-space : normal; /* crucial for IE 6, maybe 7? */
4+

Internet Explorer Weirdness

Some of you usuing Internet Explorer might come across some problems browsing this site, or you might not. Actually, I shouldn’t say problems, “minor defects” is more appropriate. Sometimes, when loading this site under IE, the navigation menu, everything from the “Search” on down, is pushed all the way to the bottom of the page. So, if you’re at the very top of the page, you probably won’t even see the menu until you scroll about halfway down.

I thought I had the issue tracked down at one point, but that’s obviously not true. Previously, I had a list showing the geographical locations of the last 5 visitors. The nav menu would go all the way to the bottom of the page each time I loaded longren.org in IE. I removed the recent visitors list from the page, cleared IE’s cache and refreshed. The nav menu looked normal, right up top where it should be.

Now, I can’t even get the menu to load at the bottom every time. Sometimes it will, sometimes it won’t. For example, I’m at the office right now and the menu looks fine on my PC in IE. If I move to another PC and load longren.org in IE, the menu will be at the bottom. All the PC’s here have IE 6.0 w/ SP2.

I can’t for the life of me figure this out, and it makes me very sad to say that. I’m gonna check it out while I’m here @ work so I can at least have a PC that the problem occurs on almost every time the page is loaded. If anyone’s got any suggestions, please let me know.

Linked @ Cao’s Blog, Wizbang, The Florida Masochist, Outside The Beltway, and as usual, Basils Blog.

UPDATE: Well, maybe this isn’t linked at some of the sites mentioned. I have noticed that TrackBacks on some sites aren’t working properly, Basil has all the dirt on what’s up with that. Hopefully TypePad and HaloScan get that fixed up soon, it’s sorta annoying.

0

IE UI Designer Switches

Scott Berkun was the UI designer for Internet Explorer (versions 1.0 through 5.0). He’s decided to make the switch to Firefox, for various reasons.

It’s a sad day and a good day. For years I’ve held onto my IE install out of love. I worked on IE 1.0 thru 5.0, and was one of the people that designed much of its UI. But my love for the past has faded. Last week I switched to Firefox: and I’ve been happy.

Check out his reasons for switching to Firefox and some UI changes he might make in Firefox. Makes for a good read, especially coming from a guy who was an IE developer.

0