May 15, 2012

CSS3 & HTML 5 Login Form With Validation

Today's tutorial is based on simple and attractive CSS3 HTML5 login and registering form with fields validation. In html5 we can actually do validation without using any external JQuery or other scripts.

In this tutorial we would:

  • Design a toggle functionality using checkbox.

  • Make two forms with HTML5 validation inputs

  • And CSS3 toppings


css3-login-form
So the logic for toggle is simple, if checked then show the form else hide the form. With CSS3 we can give transition effects.

So here is the HTML markup for Toggle:

[html]
<input type="checkbox" id="login_toggle" checked=""/>
<label id="toggle" for="login_toggle">Click here to login</label>
[/html]

CSS3 Markup for its effect and styling:

[css]
#login_toggle:checked + #login-form {
top: -210px;
}

#toggle {
background-image: url("bg.png");
border: 3px solid #FFFFFF;
float: right;
padding: 5px 50px;
position: relative;
right: 80px;
top: 210px;
color: #fff;
border-top: 0px;
text-shadow: 0 0 1px #000000;

border-radius: 0 0 4px 4px;

-webkit-box-shadow: 1px 4px 4px #000000;
-moz-box-shadow: 1px 4px 4px #000000;
box-shadow: 1px 4px 4px #000000;
cursor: pointer;
}
[/css]

In html5 we can set a new attribute to input type named as required. When this attribute is inserted then the form won't process until its validated.

HTML5 form markup

[html]
<form id="loginForm" class="right">
<div id="input">
<input class="input username" type="text" placeholder="Username" name="username" required />
<span>A</span>
</div>

<div id="input">
<input class="input password" type="password" placeholder="Password" name="password" required />
<span>L</span>
</div>

<div id="input">
<input type="submit" class="submit" value="Login">
</div>
</form>
[/html]

Simple isn't it? Just try the demo and have fun with CSS3, there's so much creativity you can do with it.

Apr 27, 2012

CSS3 Powered Portfolio & Menu

Today I just saw a nice JQuery menu which impressed me and my friends. One of my friend challenged me to make this in CSS3, so within few hours I completed the challenge and came up with a nice concept of PORTFOLIO + MENU.

I am going to share a tutorial on making a portfolio website within a menu using CSS3.

We will make a li list menu and inside that we will wrap our content div,

  • on hover of menu some nice effects + on click our content = a perfect CSS3 powered portfolio website.


css3-menu
HTML Markup:

[html]
<div id="wrapper">
<div id="portfolio">
<ul id="box">
<li style="background-color: #2C618F;">Home
<input type="checkbox" id="oneCheck" />
<label for="oneCheck"></label>
<div class="content" style="background-color: #2C618F;"><p>Welcome to WebsTutorial.Com(WT), find amazing tutorials on CSS3, HTML5, PHP, JQuery, AJAX, Wordpress and many more.<br />
Some cool tutorials.
<dl id="list">
<dt><a href="http://webstutorial.com/range-input-slider-html5-css3/html-5" target="_blank">HTML5 Range Slider</a></dt>
<dt><a href="http://webstutorial.com/css3-tabs/css3" target="_blank">CSS3 Tabs</a></dt>
<dt><a href="http://webstutorial.com/css3-clock/css3" target="_blank">CSS3 Clock</a></dt>
</dl>
</p><label for="oneCheck">X</label></div>
</li>
<li style="background-color: #91AB31;">About Us
<input type="checkbox" id="twoCheck" />
<label for="twoCheck"></label>
<div class="content" style="background-color: #91AB31;"><p>WebsTutorial is a website for all kind of website coders, here we share amazing tutorials on topics like HTML5, CSS3, JQuery, AJAX etc. We also share tutorials for making you learn PHP, cake php, codeigniter. We also work as freelancers for making websites in CMS or Frameworks.</p><label for="twoCheck">X</label></div>
</li>
<li style="background-color: #714A28;">Portfolio
<input type="checkbox" id="threeCheck" />
<label for="threeCheck"></label>
<div class="content" style="background-color: #714A28;">
<p style="overflow-y: scroll; height: 200px; padding: 0pt 40px;">
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img1.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img2.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img3.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img4.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img5.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img6.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img7.jpg" />
<img src="http://quanticalabs.com/Nostalgia/Template/image/_sample/thumb_img8.jpg" />
</p>
<label for="threeCheck">X</label></div>
</li>
<li style="background-color: #E58600;">Contact Us
<input type="checkbox" id="fourCheck" />
<label for="fourCheck"></label>
<div class="content" style="background-color: #E58600;"><p>You can always contact us by emailing us your queries, suggestions or enquiries on <a href="mailto:admin@webstutorial.com">admin@webstutorial.com</a></p><label for="fourCheck">X</label></div>
</li>
</ul>
</div>
</div>
[/html]

HTML is really simple ti understand, now comes the CSS3 code:

[css]
ul#box {
background: none repeat scroll 0 0 #EEEEEE;

-webkit-border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;

-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
float: left;
padding: 20px;
position: relative;
width: 400px;
}

#box li {
list-style-type: none;
float: left;
width: 200px;
font-size: 0px;

-webkit-transition: font ease 500ms;
-moz-transition: font ease 500ms;
-o-transition: font ease 500ms;
-ms-transition: font ease 500ms;
transition: font ease 500ms;
width: 200px;
height: 120px;
text-align: center;
color: #fff;
font-style: italic;
overflow: hidden;
}

#box li input[type="checkbox"] {
display: none;
}

#box li:hover {
font-size: 28px;

background-image: -webkit-linear-gradient(center top , rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
background-image: -moz-linear-gradient(center top , rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
background-image: -o-linear-gradient(center top , rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
background-image: -ms-linear-gradient(center top , rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
background-image: linear-gradient(center top , rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

#box li label {
background: transparent;
width: 200px;
height: 120px;
display: block;
}

.content {
height: 0;
overflow: hidden;
padding: 0;
width: 0;
font-size: 12px;

-webkit-transition: all 0.3s ease-out 0s;
-moz-transition: all 0.3s ease-out 0s;
-o-transition: all 0.3s ease-out 0s;
-ms-transition: all 0.3s ease-out 0s;
transition: all 0.3s ease-out 0s;
z-index: 100;
position: absolute;
top: 20px;
left: 20px;
}

#oneCheck:checked ~ .content,#twoCheck:checked ~ .content,#threeCheck:checked ~ .content,#fourCheck:checked ~ .content {
font-size: 12px;
height: 230px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=95)";
filter: alpha(opacity=95);
opacity: 0.95;
padding: 10px 10px 0;
width: 380px;
overflow: visible;
}

.content label {
display: none;
}

#oneCheck:checked ~ .content label,#twoCheck:checked ~ .content label,#threeCheck:checked ~ .content label,#fourCheck:checked ~ .content label {
border: 5px solid #FFFFFF;

-webkit-border-radius: 40px 40px 40px 40px;
-moz-border-radius: 40px 40px 40px 40px;
border-radius: 40px 40px 40px 40px;
color: #FFFFFF;
cursor: pointer;
font: bold 20px/40px arial,helvetica;
height: 40px;
position: absolute;
right: -20px;
text-align: center;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=95)";
filter: alpha(opacity=95);
opacity: 0.95;
background: #000000;
top: -20px;
width: 40px;
}
[/css]

We are simply using checkbox to show and hide the portfolio content using :checked pseudo class.
On checked we are showing the content div using CSS3 transition effects.

Why to use JQuery when you have power of CSS3 ;)

Apr 19, 2012

CSS3 Image Hover Effects With Caption | NO JAVASCRIPT

A simple css3 snippet share, to show image hover effects with caption text. I recently saw a website where the author of the site nicely presented his description using simple CSS3 and his own photo. Previously we use to do with having our own photo and beneath we use to write small description, but now CSS3 is here to help us.

Lets start with basic HTML layout. We will use an image, and the overlay text will be within the mask. On hover the mask will appear with CSS3 transition effect.

css3-effect

Basic HTML
[html]
<div class="view view-sixth" style="margin-bottom:30px">
<img src="PATH_TO_AUTHOR_IMAGE">
<div class="mask">
<h2>Hi, my name is Ntechi</h2>
<p>I am a php coder and sharing a simple CSS3 effect </p>
<a href="http://webstutorial.com" class="info" target="_blank">Read More</a>
</div>
</div>
[/html]
 


CSS

[css]
.view-sixth img {
-webkit-transition: all 0.4s ease-in-out 0.5s;
-moz-transition: all 0.4s ease-in-out 0.5s;
-o-transition: all 0.4s ease-in-out 0.5s;
-ms-transition: all 0.4s ease-in-out 0.5s;
transition: all 0.4s ease-in-out 0.5s;
}
.view-sixth .mask {
background: rgba(146,96,91,0.5);
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: all 0.3s ease-in 0.4s;
-moz-transition: all 0.3s ease-in 0.4s;
-o-transition: all 0.3s ease-in 0.4s;
-ms-transition: all 0.3s ease-in 0.4s;
transition: all 0.3s ease-in 0.4s;
}
.view-sixth h2 {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
background: transparent;
margin: 20px 40px 0px 40px;
-webkit-transform: scale(10);
-moz-transform: scale(10);
-o-transform: scale(10);
-ms-transform: scale(10);
transform: scale(10);
-webkit-transition: all 0.3s ease-in-out 0.1s;
-moz-transition: all 0.3s ease-in-out 0.1s;
-o-transition: all 0.3s ease-in-out 0.1s;
-ms-transition: all 0.3s ease-in-out 0.1s;
transition: all 0.3s ease-in-out 0.1s;
}
.view-sixth p {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transform: scale(10);
-moz-transform: scale(10);
-o-transform: scale(10);
-ms-transform: scale(10);
transform: scale(10);
-webkit-transition: all 0.3s ease-in-out 0.2s;
-moz-transition: all 0.3s ease-in-out 0.2s;
-o-transition: all 0.3s ease-in-out 0.2s;
-ms-transition: all 0.3s ease-in-out 0.2s;
transition: all 0.3s ease-in-out 0.2s;
}
.view-sixth a.info {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transform: translateY(100px);
-moz-transform: translateY(100px);
-o-transform: translateY(100px);
-ms-transform: translateY(100px);
transform: translateY(100px);
-webkit-transition: all 0.3s ease-in-out 0.1s;
-moz-transition: all 0.3s ease-in-out 0.1s;
-o-transition: all 0.3s ease-in-out 0.1s;
-ms-transition: all 0.3s ease-in-out 0.1s;
transition: all 0.3s ease-in-out 0.1s;
}
.view-sixth:hover .mask {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
-webkit-transition-delay: 0s;
-moz-transition-delay: 0s;
-o-transition-delay: 0s;
-ms-transition-delay: 0s;
transition-delay: 0s;
}
.view-sixth:hover img {
-webkit-transition-delay: 0s;
-moz-transition-delay: 0s;
-o-transition-delay: 0s;
-ms-transition-delay: 0s;
transition-delay: 0s;
}
.view-sixth:hover h2 {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition-delay: 0.1s;
-moz-transition-delay: 0.1s;
-o-transition-delay: 0.1s;
-ms-transition-delay: 0.1s;
transition-delay: 0.1s;
}
.view-sixth:hover p {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
-ms-transition-delay: 0.2s;
transition-delay: 0.2s;
}
.view-sixth:hover a.info {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-o-transform: translateY(0px);
-ms-transform: translateY(0px);
transform: translateY(0px);
-webkit-transition-delay: 0.3s;
-moz-transition-delay: 0.3s;
-o-transition-delay: 0.3s;
-ms-transition-delay: 0.3s;
transition-delay: 0.3s;
}

.view {
width: 200px;
height: 283px;
margin: 10px;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
-webkit-box-shadow: 1px 1px 2px #e6e6e6;
-moz-box-shadow: 1px 1px 2px #e6e6e6;
box-shadow: 1px 1px 2px #e6e6e6;
cursor: default;
background: #fff url(../images/bgimg.jpg) no-repeat center center;
}
.view .mask,.view .content {
width: 200px;
height: 260px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.view img {
display: block;
position: relative;
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.8);
margin: 20px 0 0 0;
}
.view p {
font-family: Georgia, serif;
font-style: italic;
font-size: 13px;
position: relative;
color: #fff;
padding: 10px 20px 20px;
text-align: center;
}
.view a.info {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
text-transform: uppercase;
-webkit-box-shadow: 0 0 1px #000;
-moz-box-shadow: 0 0 1px #000;
box-shadow: 0 0 1px #000;
border-radius:10px;
}
.view a.info:hover {
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}
[/css]

 

Simple and clean, use it and share it.