Posts Tagged ‘CSS’
The ‘Select’ Problem After Using jqTransform and its Solution
Thursday, February 18th, 2010
The Project
In this recent project of mine, I was required to construct a landing page. In this landing page, there would be a list of languages and after the user selects any particular language, the homepage of the site would open automatically in the respective selected language. It was also required to style the select list box in the way it was given in the design of the landing page. So I opted for the jqTransform jQuery plug-in, which I used once to style some forms. jqTransform is very nice plug-in to customize the forms in a very easy way and the end product is no doubt beautiful. But in this case, it became a minor speed breaker to my progress.
The Problem
The drop down list control of the html form contains the ’select’ tags which enclose the various ‘option’ tags. Here is a form which I am using in this tutorial to explain the problem:
<form> <h4>Select Box Without jqTransform</h4> <div id="box-city" class="select-menus"> <label>City</label> <br/> <select name="select-country"> <option>Gotham</option> <option>New York City</option> <option>Smallville</option> </select> <div class="clear"></div> </div> </form>
What jqTransform does is, it scans the whole ’select’ tag and creates an unordered list containing hyper-links of the options in the drop-down-list. It then hides the original ’select’ tag and its content.
<form class="jqtransform jqtransformdone">
<h4>Select box with jqTransform and normal select change method</h4>
<div class="select-menus" id="box-name">
<label style="cursor: pointer;">Name</label>
<div class="jqTransformSelectWrapper" style="z-index: 10; width: 150px;">
<div>
<span style="width: 119px;">Batman</span>
<a class="jqTransformSelectOpen" href="#"></a>
</div>
<ul style="width: 148px; display: none; visibility: visible; height: 100px; overflow: hidden;">
<li><a index="0" href="#" class="selected">Batman</a></li>
<li><a index="1" href="#">Robin</a></li>
<li><a index="2" href="#">Superman</a></li>
<li><a index="3" href="#">Spiderman</a></li>
</ul>
<select name="select-country" class="jqTransformHidden" style="">
<option>Batman</option>
<option>Robin</option>
<option>Superman</option>
<option>Spiderman</option>
</select>
</div>
<div class="clear"></div>
</div>
</form>
This does not create a problem when we use the ’select’ tag generally for selecting a particular value and then performing the form submission by using a submit button. It creates a problem when we want to perform some function when the value of the drop down list is changed.
This is normally achieved in javascript by using the ‘change’ method of the select control. The ‘change’ method captures the value-change event and we can access the value selected by the user in the following manner.
// Capturing the change event of the Non-Transformed Select Box.
$("#box-city select").change(function(){
var value= $(this).val();
alert("Value Selected = "+value);
});
But after using the jqTransform plugin, the ’select’ tag is no more there to apply the change method on.
The Solution
The solution to this, is a very simple one. We can simulate the change event for the jqTransformed drop down list by applying a click function to the hyper-link element within the unordered list. Then we can have the selected value by accessing the text of the span tag where the selected element is set or displayed.
// Capturing the change event of the Transformed Select Box using the modified method of capturing the value change event.
$("#box-age div.jqTransformSelectWrapper ul li a").click(function(){
var value= $("#box-age div.jqTransformSelectWrapper span").text()
alert("Value Selected = "+value);
return false; //prevent default browser action
});
Conclusion
This is one way of simulating the change function for drop-down-list boxes after using jqTransform to customize them. The other option is to modify the jqTransform plugin itself to properly access the onChange event of the ‘Select’ boxes. I hope the jqTransform plug-in developers can fix this problem in their next release of the plug-in. Though this is not a very important or common bug but I do hope that this was of some help.
Tags: CSS, forms, jqTransform, jQuery
Posted in Tutorials | 37 Comments »
Proactive Solutions UK
Saturday, December 19th, 2009
Buck Design Ltd. wanted a single page website developed for their new client, Proactive Solutions. This single page website would act as an online business card which would just contain the contact details about the company.
The Challenge
Overall the project was a simple single paged static site but the design team had a particular specification about the design. They wanted the blue abstract box in the design to be exactly at a certain distance from the logo when the page loads and they wanted it to touch the right edge of the browser at all time.
The Solution
The design of the webpage was made for a particular resolution. But web pages can be viewed in a variety of screen resolutions. Now if the screen resolution of the computer was higher than the one designed for, then obviously the abstract blue box would move away from the logo as it needed to be attached to the right edge of the browser.
After discussing it with the design team, we came to the conclusion that the first impression of the site should be such that, the box is at that much distance from the logo as it was in the design. The only possible way to achieve this was to reset the browser window to a size which would bring the blue abstract box closer to the logo. This fulfilled their first demand of the blue abstract box being near the logo when the user first opens the site. If the user increases the web browser’s size, the blue abstract box is always attached to the right edge of the browser which satisfies their second demand.
Tags: CSS, PSD to xHTML/CSS
Posted in Portfolio | No Comments »
O’ Brien and Carr Website
Tuesday, December 1st, 2009
O’ Brien and Carr website is a clean professional brochure website which also consists of a PHP based gallery. BuckDesign Studios wanted their design to be transformed into a fully working website which would load pretty fast and would be user friendly when it came to uploading images in the gallery. We achieved the target with loads of time to spare and a very satisfied client.
Tags: CSS, PSD to xHTML/CSS
Posted in Portfolio | No Comments »
Spice Up Your Twitter Feed Display Box Using CSS
Friday, October 23rd, 2009
For a very long time now there has been this trend of displaying tweets on the website’s sidebar, footer or the header. Many designers have designed ingenious ways of displaying the tweets by creating beautiful eye-catching illustrations containing them. The main purpose of making them visually attractive is so that the visitors can get interested and read the fresh updates that the site’s owner is providing. What this tutorial is going to do is enable to you to make your twitter feed display box interactive so that your visitors can go ‘wow! That’s pretty cool’ when they visit your site or read your feeds. So here it goes:
Step 1. How do I insert the feed in my website?
Inserting your twitter account’s feed in your website may become tricky. It’s a good thing there are so many tutorials out there which provide you with the knowledge of inserting these feeds easily. Here are some resources which will enable you to get the feeds from twitter onto your very own site:
1.Designing a Unique Page for Twitter Updates
2.10 Awesome Ways to Integrate Twitter With Your Website
3.Tweet!
Wordpress users can use some awesome plugins to get their twitter feed on their site:
1.35 Awesome Twitter Plugins for Wordpress
2.Juitter
3.jQuery Plugin For Twitter
Step 2. Creating the image sprite.
Now that you have successfully learned how to import the twitter feed, it’s time to configure the display area. For this tutorial, I am going to use the same design for the twitter box as I have used in this site’s footer i.e. a twitter bird staring at the tweets.

What our primary aim is that when ever the user hover’s over the twitter feed box, some action is going to take place. In our case the twitter bird will look towards the user.

You can create designs like this using various twitter icons made by some wonderful designers who love to share their work with the web community. Here is an ultimate source to these icons.
100+ Remarkably Beautiful Twitter Icons And Buttons (Always remember to ask the designer first before using these icons.)
Free vector icon set by ProductiveDreams.com
I have used the icons made by ProductiveDreams. After creating a simple box in photoshop. Place the normal twitter bird icon i.e. the one with the cross sectional view of the bird, at the bottom right side of the box such that the bird appears to be looking inside the box. Now paste the other twitter bird icon, the one which appears to be looking towards the viewer.

Then push the tilted bird icon above the older icon which you placed at the bottom right corner of the box such that it appears like a two headed twitter bird as shown below

Now hide the tilted twitter bird icon and properly mark a square containing the normal twitter bird using guide lines. Make sure that both the tilted and the normal bird fit properly in the same square made by the guidelines.


Crop the image with the normal twitter bird icon along the guidelines and open a new file and paste it there. Then check the height of the cropped image and increase the canvas size by that amount vertically. This is done so that you can paste the tilted twitter bird version on the same canvas to give the final touches to the image sprite.


Hide the normal twitter bird icon and make the other tilted bird visible. Then crop the image again along the guide lines just as you did for the previous image. Copy the image and paste it on the newly created canvas where you pasted the other image. Adjust the images so that they properly fit the whole canvas. Your image sprite is ready for use and should look like this:
Step 3. Coding the bird to life!
The html skeleton of the twitter feed box is going to be a simple one. There would be a main container div containing the twitter feed, the bird and an optional “Follow Me” link.
&lt;div id=&quot;twitter&quot;&gt; &lt;a href=&quot;http://twitter.com/SumeetChawla&quot; id=&quot;twitter-link&quot;&gt;Follow Me!&lt;/a&gt; &lt;div id=&quot;twitter-bird&quot;&gt;&lt;/div&gt; &lt;!--Your Twitter Feed Comes Here--&gt; &lt;/div&gt;
The CSS for the ‘#twitter’ container div is very simple. The ‘#twitter-bird’ div is going to contain the bird. It should have half the height of the original sprite we made because only one of the two images in the sprite will be displayed. Using CSS sprites is a good practice because it reduces server requests, hence decreases the load time and prevents the sudden flashes of the image when hovered upon for the first time.
The twitter bird div should be floated to the right and a negative margin should be assigned to it so that the bird appears to be some what outside the container div. Make the background position ‘top’ so that the normal twitter bird is displayed. To give the finishing touches to our twitter feed box, just change the background image position of the ‘twitter-bird’ div to ‘bottom’ when ever the user hovers over the container div.
#twitter {
color: #658097;
position: relative;
width: 332px;
height: 122px;
background-color: #1f1f1f;
border: 1px solid #414040;
background-position: left bottom;
background-repeat: no-repeat;
padding-left: 10px;
padding-top: 10px;
}
#twitter-bird{
background-image: url('images/twitter.jpg');
background-position:top;
position: relative;
float: right;
margin-top: 32px;
margin-right: -75px;
width: 101px;
height: 100px;
background-repeat: no-repeat;
}
#twitter:hover #twitter-bird {
background-position: bottom;
}
To see how the final result would look like, just scroll down to the footer at the bottom of this page.
Examples
Gopal Raju from ProductiveDreams has made his twitter feed look very lively and bright. The twitter bird is interactive in a very friendly and casual way. It winks and displays the total number of followers that he has.
Before Hovering:
After Hover:
This was the only site I could find which made the twitter feed box interactive. If you guys find any other site which follows this trend just post about it in the comment and I will make sure to add it here.
Tags: CSS, display feed, feed, how to, sprite, Twitter
Posted in Blog, Tutorials | 14 Comments »
How to Code an Overlapping Tabbed Main Menu
Wednesday, October 14th, 2009
There are various styles and techniques of creating a tabbed navigation menu and one of them is the tabbed overlaying or overlapped style in which each tab appears to be lying over the other and hence giving the whole menu a very realistic feel. While designing my site, I went through lots of inspirations and tutorials. One of them was this tutorial called Photoshop Paper Texture from Scratch then Create a Grungy Web Design with it! Written by Collis from NetTuts.com This ended up being the main inspiration for my site and while going through the tutorial I found Collis saying that:
” Now if I do say so myself these tabs look awesome, and the reason they do is because they overlap. Unfortunately this also makes them harder to work with in HTML. You can however do a variety of things with transparent PNGs, or alternately just make text change colours in rollovers and not worry about changing tab colours. Anyhow this is all a bit beyond the scope of this tutorial. Suffice to say the menu might be a bit tricky to build. “
So I tried coding one into html and after I succeeding thought of sharing it with you all.
Step 1.Gearing Up
So before starting to code this kind of a tabbed navigation into html/css code, you first have to learn how to create one in photoshop first. The above tutorial is very detailed and Collis does a great job in teaching how to build such a menu in photoshop. I have built one simple one specially for this tutorial.

Now let me specify that there are three states of the tab.The inactive state is grayish in colour, the active state is deep blue and the hover state is light steel blue colour. Hence, rather than slicing up three images for each tab, we can slice out an image sprite.
Step 2. Slicing The Tabs From the PSD
Align the tabs vertically using grids as shown in the image above. You can also align the tabs horizontally rather than vertically but then the CSS background image position will be accessed in a different way. The choice depends on person to person but both work perfectly. While cropping the image follow the guidelines properly and note that I have made the background transparent because we will be needing a transparent background if we need to overlap the tabs. Crop the image and save it for web in PNG24 format. One more point to note while slicing up the images is that the first tab i.e. the ‘Home’ tab should not be having any shadow on its left edge in the inactive state. Hence, for that specific tab we have to create another sprite without the shadows in it.
Step 3. Code Away
Now that our slicing is complete and we have all the images needed we can start coding our navigation bar. Just to make the example look good, I have constructed a sample featured content area layout with the overlapped navigation bar. The whole layout looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <link href="css/styles.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="page-wrap"> <ul id="main-nav"> <li class="current"><a href="index.html">Home</a></li> <li class="portfolio"><a href="portfolio.html">Portfolio</a></li> <li class="services"><a href="services.html">Services</a></li> <li class="about"><a href="about.html">About Us</a></li> <li class="contact"><a href="contact.html">Contact</a></li> </ul> <div class="clear"></div> <div id="featured"> <div id="featured-content"> </div> </div> </div> </body> </html>
Lets look at our main navigation menu. I have used a simple unordered list as any other navigation bar and styled it using a background image to the list’s hyperlink tag.
<ul id="main-nav"> <li class="current"><a href="index.html">Home</a></li> <li class="portfolio"><a href="portfolio.html">Portfolio</a></li> <li class="services"><a href="services.html">Services</a></li> <li class="about"><a href="about.html">About Us</a></li> <li class="contact"><a href="contact.html">Contact</a></li> </ul>
ul#main-nav li {
float: left;
position: relative;
display: inline;
}
Remember that we are using an image sprite for the tabs in which the top most tab represents the active state, the middle represents the inactive state and the bottom represents the hover state. Hence, we will use the ‘background-position’ property to properly place the images to their respective state as follows:
ul#main-nav li a {
position: relative;
width: 110px;
height: 29px;
display: block;
background-image: url('../images/tabs.png');
background-position: center center;
color: #44403b;
text-decoration: none;
font-size: 14px;
padding-top: 12px;
text-align: left;
padding-left: 30px;
font-weight: bold;
}
ul#main-nav li.home a {
background-image: url('../images/tab-home.png');
}
ul#main-nav li.current a {
background-position: top;
color: #ffffff;
}
ul#main-nav li a:hover {
background-position: bottom;
color: #ffffff;
}
ul#main-nav li.current a:hover {
background-position: top; /*To Prevent the Current tab from changing colour on hover*/
color: #ffffff;
}
You will notice that I have given a relevant class to each of the list elements and a class named ‘current’ to the tab which is for the current page. This is done so that I can assign different z-index values to each tab in an ascending order such that each tab lies at a higher z-axis than the tab following it. The tab with the class ‘current’ will lie at the highest order of the z-axis because it represents the current page and will always stay on top irrespective of it’s position in the list. Before applying the z-index values, make sure that the position attribute for the list element is set to relative. Without any positioning value the z-index property won’t work at all.
ul#main-nav li.current {
z-index: 100;
}
ul#main-nav li.home {
z-index: 100;
}
ul#main-nav li.portfolio {
z-index: 99;
}
ul#main-nav li.services {
z-index: 98;
}
ul#main-nav li.about {
z-index: 97;
}
ul#main-nav li.contact {
z-index: 96;
}
Even though we have assigned different z-index values to the tabs, they still don’t appear over lapped and will look like this:

To give the finishing touches to our navigation bar, we have to push each tab on top of the other. We have assigned the z-index values in descending order from left to the right. Hence, we will just push each tab starting from the right to about 20px to its left by adding a negative ‘margin-left’ property to the ‘ul#main-nav li’ and push the whole navigation bar unordered list to the left by adding a positive 20px ‘margin-left’ to nullify the left wards movement of the bar.
ul#main-nav {
margin-left: 20px;
}
ul#main-nav li {
float: left;
position: relative;
margin-left: -20px;
display: inline;
}
Mission Accomplished
After assembling all the css and the xhtml together, we will have our overlapped tabbed main navigation menu ready for use. This was my take on how to create this kind of a menu and am sure there are many better ways to do the same. I would be glad if you could share any other way of doing this or just discuss some improvements to this procedure itself.
Here are some site which use over lapping tabs as their main navigation menu:
ILove2Design.at
HiddenDepth.ie
HotCards.com
Tags: CSS, how to, menu, navigation, over lapped
Posted in Blog, Tutorials | 34 Comments »
Orange
Tuesday, October 6th, 2009
PSDTemplate.com is a great site providing some really cool website templates created in photoshop. They have a section of premium PSD layouts where they release a layout every day. They also have a free PSD layout section where they release good quality layouts available free of cost. They released Orange as one of the free PSD templates and we have coded it so that people who want to have the xHTML/CSS version of this awesome template can have that too!
Tags: CSS, Free, PSD, Template, xHTML
Posted in Blog, Downloads, Portfolio | 4 Comments »
Summer of Love
Monday, September 28th, 2009
SloDive recently posted an article named 40 Free PSD Website Templates. This is an excellent resource for designers who don’t want to start from scratch with their designing process or for developers who are not very good at designing. This xHTML/CSS template that we have coded for you guys can easily be integrated with any content management system. It is purely table-less and semantically correct for SEO purposes. Go ahead, download it and start your own band or organize a music event!
Tags: CSS, Free, PSD, Template, xHTML
Posted in Blog, Downloads, Portfolio | 3 Comments »
Business Template
Tuesday, September 1st, 2009
Business template is a free PSD Template designed by Dellustrations and is available for download at DelliBlog. We transformed this PSD template into valid xHTML/CSS code for people who want to download the code along with the PSD template.
Tags: CSS, Free, PSD, Template, xHTML
Posted in Blog, Downloads, Portfolio | 6 Comments »

















