How to create web application user interface that looks like Outlook

How many times have you heard form a client that they want "outlook-like" web user interface for their application? Me, probably a hundred of times. When I asked customer what exactly they like about Outlook user interface, I often got a similar answers. They use outlook everyday and are very familiar with the layout, look and behavior. So whenever they asked me can they have something like that, I always said "Why not"!

This is how it looks:

Outlook

You can see it live on the demo page or download the source code with all the images.

Basically, there is nothing hard about creating web user interface that looks similar to outlook. It has common layout: a header, toolbar, left-sided menu and content. It has graphic that anyone can crate with a little effort. However, customer often wanted to be able to resize the window, but they wanted layout to stretch with the window. That means two things:

  • they often wanted left-sided menu to be on the bottom of the page
  • they often wanted content to stretch with the window and to scroll its content on overflow

To put it in short, elements had to be "anchored" to window boundaries.

Anchor menu to a bottom margin

To do this you can apply very simple CSS trick: position menu absolute inside its container which is positioned relatively. You can read more about this in "Absolute Positioning Inside Relative Positioning" article on CSS Tricks.

Now let's see how to anchor outlook menu to the bottom. Navigation container will be relatively positioned, and menu will be absolutely positioned, with bottom position 0px.

 outlook_menu

Resize the content and anchor it to window boundaries

The problem here is that I wanted to stretch just some of the elements and other leave fixed. I found the solution in awesome article on A List Apart "Exploring Footers". The key is to determine the window size and recalculate the size of elements during resizing.

function getWindowHeight()
{
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number')
    {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight)
        {
            windowHeight = document.documentElement.clientHeight;
        }
        else
        {
            if (document.body && document.body.clientHeight)
            {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}

Next, we have to resize the elements in order to simulate anchoring.

function resizeWindow()
{
    var windowHeight = getWindowHeight();    
    document.getElementById("content").style.height = (windowHeight - 110) + "px";
    document.getElementById("contentPanel").style.height = (windowHeight - 160) + "px";
    document.getElementById("navigation").style.height = (windowHeight - 110) + "px";
}
At the end, just make sure to call this function on document load and resize. <body onresize="resizeWindow()" onload="resizeWindow()">

And that's all folks!

Conclusion

You saw how easy is to simulate Outlook look and feel. But, probably, you don't want your application look exactly like Outlook. Try experiment with color schemas and graphics. There are a few links that can help you with this:

Again, you can see this example live on the demo page. Try to resize the window and see the results! You can also download the source code with all the images.

More articles in Blog archive or elsewhere
Advertisement

31 Comment(s)

novice

novice 19 Jun 2008 #

Try JQuery UserInterface library. You`ld do the same much simpler.

violinista

violinista 19 Jun 2008 #

This can be easily done with extjs framework. Visit www.extjs.com, it is worth trying.

mikedopp

mikedopp 19 Jun 2008 #

So your clients want to be confused with their email application and their website? Wow.

Janko

Janko 19 Jun 2008 #

@mikedopp: actually, many of them wanted just a "look and feel" rather than a clone of it.

Vijay

Vijay 23 Jun 2008 #

I don't want to remind my customers that my site is anything like outlook. I hate outlook, it crashes my computer on a daily basis

Chad Smith

Chad Smith 23 Jun 2008 #

I have to agree with those suggesting js libraries - the design you've done looks "just about right" but as soon as you start implementing any of the features you've hinted are available, your css and js hacks will start getting exponentially worse. Even despite your disclaimer that your clients just want the look and feel, I think it's pretty niave to start a site design thinking that way, I'd rather use something I know I won't have to scrap and start again if the client demands something tricky.

I personally hate how difficult it is to do any form of vertical anchoring in css and think it should be better, inherently supported.

Janko

Janko 23 Jun 2008 #

@novice, @violinista, @Chad: Personally I don't have anything against available js frameworks (especially jQuery which I use for some time). However, not many developers I know wants to use one more framework along with the bunch of others technologies (or they are just limited by the specs or whatever). How about your environment, is the situation any different?

@Vijay: I think it's a matter of experience. Some people just love Outlook and if they want to have their application to looks like Outlook, I'm fine with that ;)

Chad Smith

Chad Smith 23 Jun 2008 #

Janko, I understand your point, but is the css and js you posted less of a learning curve (if/when you need to debug/understand it) than a js framework?

Benny S

Benny S 23 Jun 2008 #

To be honest, if a client wants a outlook style web interface, I would be getting a licanse for the telerik toolkit or just the ajax toolkit,
they have all the compontnets you'll need (resizable frames, the menu, menus and grids..). One can build such fully working interface in 2 hours, using the right tools.


Janko

Janko 23 Jun 2008 #

@Chad: I agree with you on that completely. Normally, I would do something like that, or use a tools that Benny sugessted. But sometimes you just have constraints. I'm not saying it should be done this way, but if css and plain js are everything you have, than this could be a way.

@Benny: Yes, that could also be a good solution.

Khushal Patel

Khushal Patel 24 Jun 2008 #

Great Post !!! Keep it up [Smile]

Gordon

Gordon 24 Jun 2008 #

I think it's GREAT, but how on earth does one get one of the lower menus selected, and what code is needed within it ?

Janko

Janko 26 Jun 2008 #

@Gordon: The sample I provided is just a template, it doesn't have any functionality. You have to create a different content for each link in the menu and load it on click. You can hardcode them or populate them dynamically.

Dragan

Dragan 28 Jun 2008 #

Great article! Thnx!

tefly

tefly 01 Jul 2008 #

wow thats great. i will try it. many users would feel comfortabe using a surface which looks like outlook.

free asp and asp.net articles

free asp and asp.net articles 07 Jul 2008 #

I think it's nice. I suck at all design things so I could very well see myself using your's as a base. Thanks!

Casey

Casey 09 Jul 2008 #

Nice work on the design. I might add that for people who can't/won't use javascript this can be accomplished by pure css using padding and absolute positioning and clever use of -moz-box-sizing:border-box; for gecko browsers. Additionally it takes care of the small y overflow you have.

I really like this site and find your posts very refreshing. Keep up the good work.

Cheers

Janko

Janko 09 Jul 2008 #

Thanks Casey!

Napolux

Napolux 10 Jul 2008 #

Have you ever heard of Ext.JS ? Tong

Mark Kordon

Mark Kordon 10 Jul 2008 #

I don't think thats the point here Tong

Casey

Casey 10 Jul 2008 #

All these comments about libraries like ExtJS are really pointless. Most of these libraries are over bloated with lots of unnecessary code and things you don't need. This increases your site footprint size and makes everything slower. If you are working on a commercial application using a third party library like ExtJS can often bring way more harm than good. Creating custom and granular code for the specific project you have will make things run smoother and also build your knowledge of how things work from the ground up, allowing you to better understand and solve problems in the future.

Janko

Janko 11 Jul 2008 #

Casey, that was exactly my point in this article. To build something from scratch because you learn a lot of things along the way.

kapak98

kapak98 24 Jul 2008 #

i'm struggling while googling the sample or css for a look-a-like outlook website..keep up a good work, right now i'm working on how to implement in using master pages in asp.net..

Paul

Paul 03 Feb 2009 #

Thanks, I needed something like this for an application I am working on that I want to develop in ASP. I don't know much JS at all and this is enough to get me started and have a crack. Like lots of development once you get started you end up reading around and so pick up all the required knowledge as you go.

Thanks.

SP

SP 30 Mar 2009 #

Thank you very for the great css.  

Aravind

Aravind 24 Apr 2009 #

Awesome article.....
thanks for posting.......keep them coming....

Aravind.

EmeX

EmeX 07 May 2009 #

Great job for making a tutorial like this.

Anyway, dont mind about the negative comments here, they didnt appreciate what you did that you share your humble thoughts.

The reason why he post it is for us to modify it. This interface or layout is mostly used in Web application. It is not for Content based website. The Microsoft CRM which if youre able to use is very very good in terms of functions layouts and interface. The CRM has a look and feel of Outlook. Microsoft CRM is highly costly. The trend of Web developers now is the evolution of Content based Website to Website Application. Because of this mans work that he gives us even the codes, our time to develop the UI of our application is greatly reduced.


Hopefully you give thanks to him.

Janko

Janko 07 May 2009 #

EmeX: It's ok (sometimes even good) to have a negative feedback, if it's not mean, of course. That forces us to become better in our work. Thanks for defending the original idea of sharing thoughts even if they are not perfect. Smile

PSA

PSA 01 Oct 2009 #

Cool Stuff.
I HAVE used ext and dojo for an WebApp (not a site) that looked very much like this.
And I can tell you that it was not a picnic.
Looking at your simple and clean solution makes me wonder why I wasted so much tme with those toolkits.

Now I'm building something similar but avoiding these "helpers" at all cost.

I was trying to modify your code so that I could have a third pane ( you know, the "list of things"-pane) in the middle. Proportions 15%,15% and 68%.

BUT for some reason the third panel (the content) started to slip under the menupanel when browser window was resised  narrow enough (sometjing like 600px)

I tried no-wrap here and ther, but could not find the correct combination.
Any ideas ?

PSA

Janko

Janko 01 Oct 2009 #

PSA: Thanks! Not sure what the problem really is, I guess it could be due to percents. You can use jQuery to recalculate and set the width of each panel if nothing else works.

PSA

PSA 05 Oct 2009 #

Hi Janko,

Just to let you know.
I took methvins jquery splitter-plugin and used it to manage the inner divs. And Voila.
Works like a charm and looks just like your original, except that now it is three panes.
Way cool.

http://methvin.com/splitter/3csplitter.html

Petri.

Comments are closed
via Ad Packs
9292