The other day I saw a really nice concept of a menu on the UI8 site. CreativeDash implemented that gorgeous concept and I instantly had some ideas for more effects involving border transitions but also with the desktop in mind. So today I want to show you how to create something like that and provide some more inspirational examples.

In this tutorial we will be going through demo 2 where the menu icon is in the top left corner and the border is thickest on the left side.

Please note that we’ll be using transitions and animation on pseudo-elements which won’t work in some browsers (e.g. Safari and Mobile Safari).

So, let’s get started!

The Markup

The HTML structure for our menu will consist of a nav element that will contain a trigger anchor and an unordered list with the menu items which will consist of icons:

1

2

3

4

5

6

7

8

9

10

<navid="bt-menu"class="bt-menu">

<ahref="#"class="bt-menu-trigger"><span>Menu</span></a>

<ul>

<li><ahref="#"class="bt-icon icon-zoom">Zoom</a></li>

<li><ahref="#"class="bt-icon icon-refresh">Refresh</a></li>

<li><ahref="#"class="bt-icon icon-lock">Lock</a></li>

<li><ahref="#"class="bt-icon icon-speaker">Sound</a></li>

<li><ahref="#"class="bt-icon icon-star">Favorite</a></li>

</ul>

</nav>

Let’s style this.

The CSS

Note that the CSS will not contain any vendor prefixes, but you will find them in the files.Let’s use the border-box box-sizing:

1

2

3

4

5

*,

*:after,

*::before {

box-sizing: border-box;

}

And let’s set some styles for the body and the main container:

1

2

3

4

5

6

7

body {

background: #04a466;

}

.container {

padding: 80px;

}

The padding will help providing some space around our content so that when the border appears, we guarantee that there is enough space around.

The main menu element will have position fixed so that, no matter where we are in the page, the border is always around the viewport. We set an initial border style which we will transition to a bigger border. Setting the initial height to 0 will make sure that the menu does not cover anything initially. The “backward” or closing height transition will have a delay of 0.3s:

1

2

3

4

5

6

7

8

9

10

11

12

.bt-menu {

position: fixed;

top: 0;

left: 0;

width: 100%;

height: 0;

border-width: 0px;

border-style: solid;

border-color: #333;

background-color: rgba(0,0,0,0);

transition: border-width 0.3s, background-color 0.3s, height 0s 0.3s;

}

When we open the menu, we’ll set the height to 100% (but we won’t transition that property) and the border will animate to 90px on the left side and 30px on all the other sides. The background color will be semi-transparent using an RGBA value. This will server as out overlay color:

1

2

3

4

5

6

.bt-menu.bt-menu-open {

height: 100%;

border-width: 30px30px30px90px;

background-color: rgba(0,0,0,0.3);

transition: border-width 0.3s, background-color 0.3s;

}

Now we have to use a little trick. We will add another element using JavaScript which will server as a dummy container covering the whole page except the border. This will allow us to distinguish where we are clicking in order to close the whole thing. We don’t want the menu to close when clicking on the border but only when clicking in the space between.

1

2

3

4

.bt-overlay {

position: absolute;

width: 100%;

}

When we open the menu, this element will have full height:

1

2

3

.bt-menu-open .bt-overlay {

height: 100%;

}

Let’s style that little trigger element. We’ll give it a fixed position and we’ll show it in the top left corner of the page:

1

2

3

4

5

6

7

8

9

.bt-menu-trigger {

position: fixed;

top: 15px;

left: 20px;

display: block;

width: 50px;

height: 50px;

cursor: pointer;

}

The trigger anchor itself will serve as a container and the span will be the middle line of our hamburger menu icon. So we position it in the middle by setting the top to 50% and giving it a negative top margin of half of its height:

1

2

3

4

5

6

7

8

9

10

11

12

13

.bt-menu-trigger span {

position: absolute;

top: 50%;

left: 0;

display: block;

width: 100%;

height: 4px;

margin-top: -2px;

background-color: #fff;

font-size: 0px;

user-select: none;

transition: background-color 0.3s;

}

When opening the menu, we will make a cross out of the icon. The other two lines will be created by pseudo-elements and when the menu is open, the middle line will disappear:

1

2

3

.bt-menu-open .bt-menu-trigger span {

background-color: transparent;

}

Now, let’s create the two other lines. The pseudo-elements will be positioned absolutely and their height is going to be the same like of their parent by setting it to 100%:

1

2

3

4

5

6

7

8

9

10

.bt-menu-trigger span:before,

.bt-menu-trigger span:after {

position: absolute;

left: 0;

width: 100%;

height: 100%;

background: #fff;

content: '';

transition: transform 0.3s;

}

For positioning them correctly, we’ll use translateY:

1

2

3

4

5

6

7

.bt-menu-trigger span:before {

transform: translateY(-250%);

}

.bt-menu-trigger span:after {

transform: translateY(250%);

}

The cross will be formed when opening the menu by setting the translateY to 0 and rotating the pseudo-elements accordingly:

1

2

3

4

5

6

7

.bt-menu-open .bt-menu-trigger span:before {

transform: translateY(0) rotate(45deg);

}

.bt-menu-open .bt-menu-trigger span:after {

transform: translateY(0) rotate(-45deg);

}

The unordered list with our icons will also have a fixed position and we’ll set it to the left side of the window:

1

2

3

4

5

6

7

8

9

10

.bt-menu ul {

position: fixed;

top: 75px;

left: 0;

margin: 0;

padding: 0;

width: 90px;

list-style: none;

backface-visibility: hidden;

}

Let’s set the list items and the anchors to display: block and give them full width:

1

2

3

4

5

6

.bt-menu ul li,

.bt-menu ul li a {

display: block;

width: 100%;

text-align: center;

}

Each list item will be hidden initially and the opacity will be 0. The “backward” transition of the visibility will be delayed until all the other transitions of the transform and the opacity are finished:

1

2

3

4

5

6

.bt-menu ul li {

padding: 16px0;

opacity: 0;

visibility: hidden;

transition: transform 0.3s, opacity 0.2s, visibility 0s 0.3s;

}

Now we will transform each of the list items differently so that they are all placed in the middle and to the left until they are hidden (-100% on the Y axis):

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

.bt-menu ul li:first-child {

transform: translate3d(-100%,200%,0);

}

.bt-menu ul li:nth-child(2) {

transform: translate3d(-100%,100%,0);

}

.bt-menu ul li:nth-child(3) {

transform: translate3d(-100%,0,0);

}

.bt-menu ul li:nth-child(4) {

transform: translate3d(-100%,-100%,0);

}

.bt-menu ul li:nth-child(5) {

transform: translate3d(-100%,-200%,0);

}

When opening the menu, the list items will become visible (instantly, because we are not setting a transition for it) and they will fade in. They will also move to their original positions by setting the transform3d to 0 for all axes:

1

2

3

4

5

6

.bt-menu.bt-menu-open ul li {

visibility: visible;

opacity: 1;

transition: transform 0.3s, opacity 0.3s;

transform: translate3d(0,0,0);

}

Now, let’s style the anchors. We will use an icon font and include the font reference and the icon classes in another CSS which will be provided by a service like Fontastic or the IcoMoon app.

By setting the font size of the anchor to 0 and make it transparent, we’ll hide the text:

1

2

3

4

5

6

7

.bt-menu ul li a {

display: block;

outline: none;

color: transparent;

text-decoration: none;

font-size: 0px;

}

We’ll reset the font size for the pseudo-element which contains the icon. We’ll need to use a pixel-based value because the main element has a font-size of 0 so ems won’t work here:

1

2

3

4

5

.bt-menu ul li a:before {

color: #04a466;

font-size: 48px;

transition: color 0.2s;

}

On hover we’ll make them white:

1

2

3

4

.bt-menu ul li a:hover:before,

.bt-menu ul li a:focus:before {

color: #fff;

}

And last, but not least, we want the icons to be smaller on mobile screens:

1

2

3

4

5

@media screenand (max-height: 31.125em) {

.bt-menu ul li a:before {

font-size: 32px;

}

}

And that’s all the style. Now, let’s move on to the JavaScript.

The JavaScript

Our script is pretty straightforward; when we click on the trigger anchor, we toggle the class bt-menu-open and bt-menu-close on the nav element. (Adding the closing class is only needed if you are using animation for the trigger icon effect, just like we do in demo 1. This will allow us to only play the backward animation, when we close the menu).

When we click on the overlay, we will close the menu. We’ll also add some touch support:

Favico.js: Animate your favicon

Want to add badges, images, or even video to your favicon? Favico.js makes it simple to add animated badges for your favicon, or create a favicon on the fly from an image, video, or even a live image from your visitor’s webcam.

15 Online HTML5 Tools for Web Designers

by Andy on October 10, 2012

Online HTML5 tools are quite useful for web designers who wants to
forge ahead of the competition, and have more satisfied clients. It is
of course important to follow developments and keep an eye on new tools
that emerge.

HTML5 is the new version of the markup language HTML that has been
used for presenting and structuring online contents since the early 90s.
It is an internet core technology that was proposed originally by Opera
Software. If you want to learn more of it’s background and history
these HTML5 infographics
can help you. HTML has been standing in the shadow of other frameworks
like Flash and IE, but the word is, that this is going to change with
the arrival of HTML5. As of today, HTML5 is still being developed, but
believe me, it is here to stay.

HTML5 has opened a window of opportunities for web designers. Online
web design tools based on HTML5 makes it easier to incorporate audio,
video, drag and drop, fonts, animations and graphics into web pages.
HTML5 also helps web designers build mobile friendly website themes
to ensure excellent user-experience when surfing the Internet on mobile
devices. However, since such tools are fairly new, some people may
still be unaware of their true potentials. Also, some web designers
still want to use Flash and other popular framework as their primary
tool set.

Below, I have listed 10 useful online HTML5 tools. They can provide
developers and web designers with manoeuvrability in making websites
more convenient, productive and attractive.

If you are a designer, you might find it difficult to choose a decent
font. However, using this online font testing tool can make the process
much easier. You can view any font you want in a webpage without
changing its CSS or HTML code.

Liveweave is a new playground for developers and designers to test
HTML, CSS and Javascript. Liveweave editor has built-in
context-sensitive autocompletion for HTML4/HTML5 and CSS2/CSS3, that
makes life a lot easier.

HTML KickStart is not really a tool, it is a set of HTML5, CSS, and
jQuery building blocks for website development. It includes files,
layouts, and elements that will give you a headstart and save you hours
on your projects.

Stitches is a really easy-to-use HTML5 sprite sheet generator. Simply
drag and drop image files onto the app, click “Generate” and your
sprite and stylesheet will be good to go. Currently compatible only with
the latest version of Firefox and Chrome.

These days, compressing images seems to be the rage. By placing your
photos in a Sprite, you can increase the rate of your loading times as
well as image transitions. Online Sprite Box Tool will aid in designing
photos into sprites with the use of HTML5, CSS3 and jQuery.

This sketch tool uses the capability of HTML canvas in creating 3D
drawing. The tool will allow you to draw with dashed lines and vibrate
your drawing. You can also rotate the 3D canvas by dragging with the
cursor horizontally while pressing down the Space Bar.

This is an online tool that can be quite useful for creating header
and page backgrounds. Designers can even use the tool to create heading
backgrounds. The tool will allow you to try out any pattern you want in
just a few seconds.

Online XRay Tool allows designers to quickly view the details of
various page elements that are present in any webpage with just a few
clicks of the mouse. Just drag the website bookmarklet into your own
book bookmarks, go to the webpage you like to analyze, click on the XRay
bookmark and then click on any element of the page. The tool can take
care of HTML5 elements like canvas and give you the design data you
need.

Among the best features of HTML5 is the introduction of the audio
tag. This tool will help designers get familiar with the newest audio
features being offered by HTML5. Even more interesting is the fact that
designers can play, not just with audio, but also with video integration using this HTML5 online tool.

Group Discussion!

Please tell us what you think of these HTML5 tools by adding your
comments below. And please, if you have considerable experience with an
online HTML 5 tool not included in my list, let me know about it. You
are also welcome to share this article to your friends and colleagues.