Sunday, 8 June 2008

Clean and pure CSS FORM design

Some readers of my blog hate html tables and often ask to me which is the better way to design FORMS with CSS, without using tables to place each form element in a table's cell.

How I said some time ago... tables are not evil. Sincerly, in some case I used pure CSS code to design forms but, in general, I prefer to use tables. It's simpler and faster than use only CSS property "to simulate" a table structure. In any case, for CSS lovers, this tutorial illustrates a proposal about how to design a pure CSS form without using html tables.


You can download the source code and use it in your web projects.


Download source code


Step 1: HTML Code
Create a new page index.html and copy and past this code into the tag <body>:

<div id="stylized" class="myform">
<form id="form" name="form" method="post" action="index.html">
<h1>Sign-up form</h1>
<p>This is the basic look of my form without table</p>

<label>Name
<span class="small">Add your name</span>
</label>
<input type="text" name="name" id="name" />

<label>Email
<span class="small">Add a valid address</span>
</label>
<input type="text" name="email" id="email" />

<label>Password
<span class="small">Min. size 6 chars</span>
</label>
<input type="text" name="password" id="password" />

<button type="submit">Sign-up</button>
<div class="spacer"></div>

</form>
</div>

How you can see from the code above, the structure of our CSS form is the following:



I used <label> for the name of each input element and <span> tag for the short description. All labels and input elements have float CSS property set to left;


Step 2: CSS Code
Copy and paste the following CSS code in the <head> tag of your page:

body{
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0; margin:0; padding:0;}
.spacer{clear:both; height:1px;}
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:400px;
padding:14px;
}

/* ----------- stylized ----------- */
#stylized{
border:solid 2px #b7ddf2;
background:#ebf4fb;
}
#stylized h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
#stylized label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #aacfe4;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666 url(img/button.png) no-repeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}


This is only a proposal for the form layout. You can reuse this code changing all properties how you prefer.

Download source code


Related Post
Table's anatomy: why tables are not so bad
Are you a CSS fanatic?
Improve form usability with auto messages

Read More

Wednesday, 4 June 2008

Photoshop Lady: best Photoshop tutorials around the world

Photoshop Lady is a great resource on-line (with a very nice layout), which provides you daily, all the best Photoshop tutorials to find inspiration and new ideas for your design projects.

All tutorials are divided in categories (3D, abstract, drawing, photo, text, texture, patterns effects) to make simpler browsing and finding everything you are looking for. You can also create your custom profile, save your preferred bookmarks, vote and share them with all other readers.



Subscribe RSS Feed
In order not to miss all new post visit Photoshop Lady and subscribe the RSS feed of the site.
For more info about this site take a look at the link below:

Photoshop Lady



Related post
Get a review for your site

Read More

Monday, 2 June 2008

Beautiful CSS buttons with icon set

Do you like simple and clean design? Take a look at this collection of buttons for your website.

I love clean design and in general simple solutions to design nice and attractive elements for my websites. This tutorial illustrates how to design nice clean buttons using some lines of HTML, CSS code and proxal icon set. The result is something like this:


Simple, clean and nice. Click on the link below to download the source code ready to use in your web projects.

Download source code


Step 1: HTML Code
You can design this kind of buttons using this simple structure: a link (<a> tag) with a span tag inside, in this way:

<a href="#" class="button">
<span class=
"add">Add to your bookmark</span>
</a>

You can replicate this structure for all buttons you want to add in your page:



...where link tag (<a>) is the "container" of the button:




...and class property for span tag is equal to CSS class which contains in CSS background propery the icon you want to apply to the current button:




For example, you can define new buttons in this way:

<a href="#" class="button">
<span class=
"delete">Delete this bookmark</span>
</a>

<a href="#" class="button">
<span class=
"user">Add to friends</span>
</a>



Step 2: CSS Code
This is the CSS code for button "container" which includes the button background and how the button looks (font, width, height...):

a.button{
background:url(img/button.gif);
display:block;
color:#555555;
font-weight:bold;
height:30px;
line-height:29px;
margin-bottom:14px;
text-decoration:none;
width:191px;
}
a:hover.button{
color:#0066CC;
}

...and now we can add some classes to design each button in this way:

/* -------------------- */
/* CLASSES */
/* -------------------- */
.add{
background:url(img/add.gif) no-repeat 10px 8px;
text-indent:30px;
display:block;
}
.delete{
background:url(img/delete.gif) no-repeat 10px 8px;
text-indent:30px;
display:block;
}
.user{
background:url(img/user.gif) no-repeat 10px 8px;
text-indent:30px;
display:block;
}
...

For each class, you can set background property with the icon you want, directy from your preferred icon set. In this example I used Proxal Icon Set V2, a very clean and nice icon set I found on Deviantart. Thake a look here for the original link to this icon set.

Download source code


Related content
See also:

CSS Message Box collection
Perfect pagination style using CSS

Read More

Sunday, 1 June 2008

Google Spreadsheets Tips: Gantt Chart (Microsoft Project-like) using Widget

Google Spreadsheets is a powerful web application to do everything you do using Excel. A nice way to use it is to manage a project plan with a gantt chart (microsoft project-like) and share it on-line with your team.This is a free and versatile solution to do that. This tutorial illustrates how to use Google Spreadsheets Viewpath Gadget to implement it.


Take a look at this spreadsheet


Step 1: Project Plan structure
First step is defiing your project plan structure. I suggest you to use this basic structure:
Column A: Task ID (WBS) (an unique ID which identifyes each task with a progressive number).
Column B: Task description (a short description of the activity).
Column C: Percentage of completion (0%-100%).
Column D: Predecessor (finish-start relationships between tasks).
Column E: Start date (task start date).
Column F: Finis date (task finish date).
The result is something like this:



All previous fields are required for viewpath gadget but, if you want, you can add other columns with other infos (for example the name of a resource assigned to each task, task duration in terms of day, ecc...). When your project plan structure is completed you are ready to add Gantt Chart using Google Spreadsheets Viewpath Gadget.

Step 2: Add Gantt Gadget
Click on Chart icon and select Gadget option.



In the Gadget window find and select Gantt Chart gadget (by Viewpath) and click on Add to spreadsheet button:



In the option window assign all required parameters to the correct column of your project plan structure (for example Start dates in this example are in the column E):



After assigned all columns, click on apply button and see the result. Now you can save your project plan , publish and share it with all member of your team.


Related Content
See also the following link about this topic:

Read More

Friday, 30 May 2008

Pastel color menu with dynamic submenu using CSS

Do you want to add dynamic features to your menu?

This tutorial illustrates how to design a nice pastel color menu with a dynamic submenu which appears when you select a link in the main menu, using CSS and some lines of javascript code. The result is like this:


Download the source code to reuse it in your pojects (images included).

Download source code Live Preview


Step 1: HTML Code
HTML code is very simple: you can use the flexibility of elements ul, li to design the menu / Submenu structure. I added also a green header above the menu, which you can use to add for example your site logo:

<!-- HEADER -->
<div id="top-navigation">
<!-- Something in the header here -->
</div>

<!-- Main Menu -->
<div id="navigation">
<ul id="mymenu">
<li><a href="#" onmouseover="javascript:showsubmenu(1)">Home</a></li>
<li><a href="#" onmouseover="javascript:showsubmenu(2)">Movies</a></li>
<li><a href="#" onmouseover="javascript:showsubmenu(3)">Music</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>

<!-- SUB MENU -->
<div id="sublinks">
<ul id="s1">
<li><a href="#">General</a></li>
<li><a href="#">Information</a></li>
<li><a href="#">News</a></li>
</ul>

<ul id="s2">
<li><a href="#">Drama</a></li>
<li><a href="#">Thriller</a></li>
<li><a href="#">Action</a></li>
<li><a href="#">Horror</a></li>
<li><a href="#">Colossal</a></li>
</ul>

<ul id="s3">
<li><a href="#">Rock</a></li>
<li><a href="#">Pop</a></li>
<li><a href="#">Classical</a></li>
</ul>
</div>

How you can see each link in the main menu calls a javascript function showsubmenu() which takes in input the ID of the submenu you want to display.
Each <ul> element into the layer #sublinks is a submenu related to a link in the main menu. You can identify each submenu with a progressive id, for example in this case with: S1, S2, S3...


Step 2: CSS Code
Copy and paste this code in the <head> tag of your page:

ul, li{border:0; padding:0; margin:0; list-style:none;}

/* ----------- Navigation ----------- */
#top-navigation{
background:url(img/topnav-bg.gif) repeat-x;
width:auto;
height:48px;
margin:0 auto;
}
#navigation{
background:url(img/nav-bg.gif) repeat-x;
height:32px;
margin:0 auto;
width:auto;
}
#navigation ul{
height:32px;
line-height:32px;
}
#navigation ul li{
display:inline;
}
#navigation ul li a,
#navigation ul li a:visited {
background:url(img/line-a.gif) right no-repeat;
padding:0 20px;
display:block;
text-decoration:none;
float:left;
color:#4261df;
font-weight:bold;
text-shadow:#ffffff 2px 2px 2px;
}
#navigation ul li a:hover{
color:#1532a5;
}

/* ----------- Sub Menu ----------- */
#sublinks{
width:auto;
margin:0 auto;
background:#888888 url(img/sublink.gif);
height:30px;
font-size:11px;
}
#sublinks ul{
height:32px;
line-height:31px;
}
#sublinks ul li{
display:inline;
}
#sublinks ul li a,
#sublinks ul li a:visited {
padding:0 20px;
display:block;
text-decoration:none;
float:left;
color:#FFFFFF;
}
#sublinks ul li a:hover{
text-decoration:underline;
}

/* ----------- Hide Sub menu ----------- */
#s2, #s3{display:none;}

When the page is loaded for the first time I want to display by default the submenu with ID #S1. So, I have to set CSS display property for #S2 and #S3 to "none";


Step 3: Javascript Code
Now add this simple javascript function showsubmenu() to shows/hides the submenu related to the link on the main menu. This function takes in input a parameter which is the ID of the submenu you want to display (take a look at the step 1):



Copy this code in the <head> tag of your page:

<script type="text/javascript">
function showsubmenu(id){
submenu = document.getElementById('s'+id);
for(i=1;i<=3;i++){
if(i==id){
submenu.style.display="block";
} else {
document.getElementById('s'+i).style.display="none";
}
}
}
</script>

This line of code execute a for cycle from 1 to 3, where 3 is the total number of submenu you have in your HTML code (in this example #S1, #S2, #S3):

for(i=1;i<=3;i++)...


If you want to add a new link in the main menu with a new submenu related at this link, increase the condition (3) of one unit (4):

for(i=1;i<=4;i++)...


...and in the HTML code (step 1), remember to add a new ul element with ID="s4" in this way:

<ul id="s4">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>


It's all!

Download source code


Related Content
Simple CSS vertical menu Digg-like
Two CSS vertical menu with show/hide effects

Read More

Tuesday, 27 May 2008

Google Spreadsheets Tips: Invert word position using formulas

Are you a Google Spreadsheets users? Take a look at this tips to invert words into a string.

Ok guys, finally I have a litte bit of time to add a new post on my blog. Today I want to return to talk about Google Spreadsheets, illustrating simple tips very useful to invert automatically (using some basic formula) the order of words in a cell.


You can also use all formulas in this example in Excel.

Take a look at the spreadsheet here

Download Excel file


Step 1 - Input data
For example, image you have a column with several names (name + surname):

Jack Bauer
Christian Troy
Gregory House
Micheal Scofield
Lincoln Burrows
...

...and for some reason you need to invert the order in surname + name. You can do it manually... but in case of more then ten names could spend a lot of time to do it. A good solution is using some formulas


Step 2 - Find a criteria to separate words
What is it the criteria you can use to split single words? In this example is the space (" ") between name and surname. You have only to find the "position" of the space (" ") to have a reference to split the content in the cell. You can do it using find() formula in this way:

=find(" ";B5;1)

This forumlas return the index (position) of the space (" "), contained into the text in the cell B5, starting to the position "1".



...for the cell B5 (Jack Bauer) the space is at position 5 (index = 5).

Step 3 - Extract words
Now, in a new column you can extract the surname and in another column the name. To extract the surname you can use right() formula combined with len() formula:

=right(B5;len(B5)-C5)

...where len() formula return the lenght (number of chars) of the text contained in the cell B5.

To extract the name you can use left() forumla:

=left(B5;C5)


Step 4 - Concatenate extracted words in a new order
Finally, you can concatenate words you extracted in the order "surname and name", using concatenate() forumla:

=concatenate(D5," ",E5)

...concatenate surname (D5), a space (" ") and name (E5).

It's all!

Take a mind, you can also use the same formulas in Excel but remember only to separate formula parameters using ";" instead of ",".


Related Content
See also:

Read More

Friday, 23 May 2008

"Woork" in progress...

Dear friends, long time is passed since my last post on this site. For all those who wrote me asking some info about my news I want to assure them: it's all ok. I am very busy with my work and it's very hard for me to mantain updated my blog.
In the past month I received a lot of e-mails from a lot of people and I couldn't reply to everyone. I'm sorry. I want to say thanks to everyone for your interest and your support.
I hope to add new post on my site as soon possible.

Best regards

Antonio


Read More