Fancy Fieldset Legend in CSS

So While checking out this page on CSS-Tricks http://css-tricks.com/examples/ModalLogin/# I decided to see if I could recreate the layout in pure css.

by Zireael

HTML

<form action="">
        <fieldset>
            <legend><span>Log in</span></legend>
            <div>
                <label>Email</label>
                <input type="text" />
            </div>
            <div>
                <label>Password</label>
                <input type="password" />
            </div>
            <div>
                <label>Remember Me?</label>
                <input type="checkbox" />
                <input type="submit" value="Log in" />
            </div>
        </fieldset>
    </form>

CSS

body {
    font-family: Calibri;
    background: #ddd;
}
label {
    width: 8em;
    text-align: right;
    display: inline-block;
}
input[type=submit] {
    width: 5em;
}
fieldset {
    background: #eee;
    border-radius: 10px;
    margin: 1.25em;
    padding: 0.75em;
    box-shadow: 0.5px 1px 5px rgba(0,0,0,.2);
    position: relative;
    border: 0.1em groove #ccc;
}
legend {
    position: absolute;
    top: -0.2em;
    left: 2em;
    background: #fff;
    border: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,.3);
    font-weight: bold;
}
legend span {
    display: block;
    margin: -0.5em;
    background: linear-gradient(transparent 0em, transparent 0.58em, #eee 0em);
    padding-left: 0.35em;
    padding-right: 0.35em;
}

JavaScript

$('.toggle').click(function(){
    $('form').toggleClass('alt');
});