Pages

Tuesday, March 13, 2012

How to Change image on rollover(MouseOver) in CSS



Its been a long time since i've posted an article. Today iam posting something that is easy to implement and is used widely these days i.e, changing an image on rollover(mouseover).Let's start with the simple mark-up

HTML:
 <a href="#" id="iconchange">Icon</a>

Now lets come to the css

CSS:
#iconchange{
height: 20px;
width: 158px;
text-indent: 10000px;
overflow: hidden;
background: url(icon.gif) top left no-repeat;
display: block;

}

#iconchange:hover{

background-position: bottom left;
}

That's it. its simple as that. Go now and use it in your project designs.:)

Saturday, March 3, 2012

How to create cool Navigation Menu Easily in CSS



As we all know that for providing navigation to the user,we use navigation menu on our websites. Today i am going to show you how you can easily create a navigation menu for your website. Let's start with HTML


HTML Code :


<html>
<head>
<title>Navigation Menu</title>

</head>
<body>
<ul id="nav">
<li><a href="#" >Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Company</a></li>
</ul>
</body>
</html>

This is our menu list. Now lets apply the magic of CSS.


CSS Code :

#nav{
        width: 960px;
        margin: 80px auto;
        text-align: center;
}


#nav ul{
        margin: 0;
        padding: 0;
}









After adding this CSS you'll get something like above.the code specifies the alignment of the menu which is center and width and the margin. Now lets add some more code,



#nav li{
        margin: 0 10px; /* Add some horizontal spacing */
        display: inline-block;
        *display: inline;  /* IE7 and below */
        
}

the above code will give you this
Now we got the basic layout of our menu. Let's add styling it with color.

#nav a{
        display: inline-block;
        position: relative;
        padding: 8px 15px;
        border: 2px solid #ddd;
        text-decoration: none;
        color: #999;
        font: bold 14px 'Lucida sans', Arial, Helvetica;
        background-color: #000;
        background-image: linear-gradient(top, #eaeaea, #fff);
        border-radius: 3px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .05) inset,
                                0 0 1px 0 rgba(0, 0, 0, .2),
                                0 2px 2px rgba(0, 0, 0, .3),
                                0 10px 10px -5px rgba(0, 0, 0, .2);
}

The above code will give the coloring to our menu.I have used box-shadow to give some good effect to our menu. Above code will give you the below result


Now that we've got our menu. Let's give some hovering effects to it.

#nav a:hover{
        background-color: #eaeaea;
        background-image: linear-gradient(top, #000, #000);
}       

#nav a:active{
        top: 1px; /* Simulate the push button effect */
        background: #fff;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .05) inset,
                                0 0 1px 0px rgba(0, 0, 0, .2),
                                0 1px 2px rgba(0, 0, 0, .3);
}

That's it. You've got your menu. You might see that i've given some good horizontal space. you may reduce it by decreasing the margin value in #nav li{}. Hope you like it and share it.

Tuesday, February 28, 2012

How to Create Follow Us sidebar or a fixed sidebar Menu in CSS3


Today,I am going to show you how you can create a Fixed Sidebar or should i say a Pinbar that remains even when you are scrolling down. Like the one that  appears on my blog.So,lets start with the HTML

HTML Code:


<html>
<head>
</head>

<body>
<p>Follow Us</p>
<ul id="social_side_links">
<li><img src="digg.png" href="#" /> </li>
<li><img src="fb.png" href="#" /></li>
<li><img src="twitter.png" href="#" /></li>
</ul>
</body>
</html>


Now if you don't own a website and use Blogger like me. Then you should go to AddThis and signup there if you are not registered. Get the code from from follow Tools tab. and just paste it under <ul> tag and  in place of <li> tags.
Now lets go to the CSS.


CSS Code :



<style type="text/css">
#social_side_links {
    position: fixed;
    top: 90px;
    left: 0;
    padding: 5px;
    
    background: #555;
    background: -webkit-gradient(linear, left top, left bottom, from( #555 ), to( #111 ), color-stop( 50%, #444 ), color-

stop( 50%, #333 ));
    background: -webkit-linear-gradient(#555, #444 50%, #333 50%, #111);
    background: -moz-linear-gradient(#555, #444 50%, #333 50%, #111);
    background: -ms-linear-gradient(#555, #444 50%, #333 50%, #111);
    background: -o-linear-gradient(#555, #444 50%, #333 50%, #111);
    background: linear-gradient(#555, #444 50%, #333 50%, #111);
    border-width: 2px 2px 2px 0;
    border-style: solid;
    border-color: #777 #888 #999;
 -webkit-border-top-right-radius: 6px;
    -moz-border-top-right-radius: 6px;
    border-top-right-radius: 6px;
    -webkit-border-bottom-right-radius: 6px;
    -moz-border-bottom-right-radius: 6px;
    border-bottom-right-radius: 6px;
    -webkit-box-shadow: #888 7px 0 10px -5px;
    -moz-box-shadow: #888 7px 0 10px -5px;
    -o-box-shadow: #888 7px 0 10px -5px;
    box-shadow: #888 7px 0 10px -5px;   
}
p{font-size:25px;font-family:arial,helvetica,sans-serif;}
</style>

Well it might look like a lot of code for a simple work however it is actually simple in reality.
Iam using gradients for the background. you may use some online tools to generate the gradient if you don't know how to make the CSS gradient. 
Border-radius is used to give curvy corners as i have shown in my previous post How to create rounded corners Using CSS .
Box-shadow is one of the best features of CSS3 and is used to give a shadow effect to the box. I'll show you the syntax to make the usage clear

Syntax :Box-shadow:color x-offset y-offset blureffect 

Using a negative spread radius, you can get squeeze in a box shadow and only push it off one edge of a box.Which is the fourth value in our example.
Apart from giving a follow us sidebar , you can also use it to make an always appearing Sidebar menu for easy navigation.

Sunday, February 26, 2012

CSS3 Zoomy: Zoom-in and Zoom-out with click in CSS3

Don't worry iam not using Javascript. This is done purely in CSS3. Yes,you heard it right. Now you can handle click event like JQuery in CSS3. Thanks to Transition effect. This can be done easily and with using only few lines of code. Don't worry if you are not yet familiar with CSS3 tricks. I'll soon be providing you some tricks that can be done in CSS3.Lets start with our CSS3 zoom. Iam also using HTML5 tags in here. You may be hearing it for the first time.But don't worry i'll explain them with the code. As said earlier i'll also be updating the HTML5 tags along with CSS3 tricks.
So lets start with the html code.

HTML :
<!DOCTYPE html>  
<html lang="en">  
<head></head>
<body>

<h1> CSS3 Zoomy: Zoom-in and Zoom-out with click in CSS3 </h1>  
   <figure>  
      <img id="zoomy" src="http://www.tuvie.com/wp-content/uploads/rca-sleek-sustainable-concept-car1.jpg" alt="sleek" />  
      <figcaption>  
         <ul>  
            <li>  
               <a href="#zoomy">Zoom In</a>  
            </li>  
            <li>  
               <a href="#">Zoom Out</a>  
            </li>  
         </ul>  
      </figcaption>  
   </figure>
</body>
</html>

The above is a HTML5 code.Now you don't have to write the whole document type declaration.Just <!doctype html> would do the work in HTML5. The <figure> element is intended to be used along with <figcaption> to mark the diagrams.photos and code examples etc. <figcaption> purpose is to add caption to the image.
Now lets get along with the CSS code. Its simple.


CSS code :

<style type="text/css">  
       figure { background: #e3e3e3; display: block; float: left;}  
ul{list-style: none;}
       #zoomy {  
          width: 200px;  
          -webkit-transition: width 1s;  
          -moz-transition: width 1s;  
          -o-transition: width 1s;  
          transition: width 1s;  
      }  
  
     /* Compliance to IE8+, Firefox 2+, Safari, Chrome, Opera 10+ */  
      #zoomy:target {  
         width: 400px;  
      }  
    </style>  




Its really simple isn't it? You can play along with it by using the transition effect. Like zooming the image just by hovering it. Please share if you like it.

Saturday, February 18, 2012

How to Make Accordion Menu in CSS with Hover Effect Like JQuery


Today with only CSS we are going to make an Accordion Menu,Which will have hover effect like JQuery. We are going to make it with pure CSS. Lets start the magic now, First add this HTML markup

HTML Markup :



<ul class="accordion"> 
        <li><a href="#">Home</a>
<ul>
<li><a href="#">About Us</a></li>
<li><a href="#">Why Us</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Our Locations</a></li>
</li>
</ul>
<li><a href="#">Sty Connected</a> <ul>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Network</a></li>
</ul></li>
<li><a href="#">Services</a>
<ul>
<li><a href="#">Web Design</a></li>
<li><a href="#">Web development</a></li>
<li><a href="#">SEO</a></li>
<li><a href="#">Wordpress</a></li>
<li><a href="#">Drupal</a></li>
</ul>
</li>
</ul>

After adding the above markup,You'll get a picture like this


Now we need to add some style to it,


CSS:


.accordion {
margin: 0px auto;
padding: 0px;
list-style: none;
width: 240px;
font-family: Arial;
                        font-size: 90%;
background-color: #111;
}


.accordion li {
overflow: hidden;
}


.accordion li a {
display: block;
border-bottom: 1px solid #444;
background-color: #222;
text-decoration: none;
                                color: white;
                                text-align:center;
                               padding: 5px;
                               outline: none 0px;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}




Now you'll get some thing like this

Looks Quite Good isn't it? We are ready with our menu layout and coloring. But now we need to add some more CSS to make the amazing hover effect and to make it work like a Accordion Menu.


CSS:



.accordion li a:hover {
background-color: #180000;
                             -webkit-scrollbar-button:vertical;
}
.accordion > li:first-child >a:first-child {
border-top: 1px solid #444;
}
.accordion ul {
margin: 0px;
padding: 0px;
                               list-style: none;
height: 0px;
                               overflow: hidden;
transition: 1s;
-moz-transition: 1s;
-webkit-transition: 1s;
}
.accordion li:hover ul,
.accordion:not(:hover) li:first-child ul {
                                    height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
}
.accordion ul li a {
color: #AAA;
                       border: 1px solid #777;
border-top: 0px none;
background-color:#680000;
white-space: nowrap;
overflow: hidden;
}
.accordion ul li a:hover {
background-color: #500000;
}



Now after this you'll get your accordion menu like this








Looks Great isn't it?...Just add your menu list and customize yourself the color of the accordion menu according to your requirement.Please share with others if you like it.And keep visiting my blog for other exciting stuff on web designing.

Monday, February 13, 2012

How to create an amazing blur menu with CSS



Ever wanted to create a good creative and amazing menu? well you are in treat for today.Today iam going to show you how to create an amazing blur menu with CSS.Alright so lets start with the markup i.e, HTML.
A simple HTML will do the work now but you can customize your own menu.


The HTML :



<html>
<head>
<link rel="stylesheet" href="blurmenu.css" 


type="text/css"/>
</head>
<body>
<ul class="bmenu">
    <li><a href="#">About</a></li>
    <li><a href="#">Illustrations</a></li>
    <li><a href="#">Photography</a></li>
    <li><a href="#">Web Design</a></li>
    <li><a href="#">Personal Projects</a></li>
    <li><a href="#">Contact</a></li>
</ul>
</body>
</html>


The CSS:


Now lets go the CSS and add this 



.bmenu{
    padding: 0px;
    margin: 0 0 10px 0;
    position: relative;
}



.bmenu li{
    font-size: 50px;
    display: block;
}



You'll get something like this
doesn't look like a good menu eh? but it is basic form of our menu.Now we'll add some color to our menu



.bmenu li a{
    display: block;
    text-transform: uppercase;
    text-shadow: 0px 0px 2px #111;
    color: #ddd;
    padding: 5px 20px;
    margin: 2px;
    background: rgba(0,0,0,0.7);
    letter-spacing: 1px;
    -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}



You'll get the picture like this


Now it looks quite good isn't it? You can customize your own colors in it according to your design.Now lets add the magic of the blur effect.Whenever you hover or put your cursor on  each menuitem other menuitems will become blur.To get this effect just add this code



.bmenu:hover li a{
    text-shadow: 0px 0px 10px #eeb213;
    color: transparent;
    background: rgba(0,0,0,0.2);
}
.bmenu li a:hover{
    background: rgba(0,0,0,1.0);
    text-shadow: 0px 0px 1px #eeb213;
}

After you add the above code  you'll get the effect as shown in the picture below





Great isn't it?...you can customize your menu vertically and according to your design and coloring.Thanks for reading and keep visiting my blog for more articles.

Wednesday, February 8, 2012

Three (3) Important SEO Plugins for your Wordpress Blog



SEO is on the tip of the tongue of every webmaster. Even experienced some webmasters find SEO a complete fuddle (including me). Another plus point is that to gain traffic you have to rely on a search engine for sure so SEO is much required if this is the scenario.

WordPress is a decent platform to start blogging and notifying search engines. And to add icing to cake, you can literally avoid thinking much about your onpage SEO score using these plugins.

In my opinion these 3 plugins are a must have for every wordpress blogger. Here lets have a look

All in One SEO Pack

This is the best SEO plugin for your blog. It basically allows you to set the most commong SEO things for your blog like the titles, meta tags, keywords, and descriptions. Allows you to configure them for your entire blog or on a post by post basis.

Redirection

Often you keep changing permalinks on your blog like for instance when you add some categories or something else. And this leads to break of your previous links on your blog. This plugin does te redirecting the visitor to the new permalink thing. means even if you forget to update an old link in your post the plugin will redirect the user reducing the amount of traffic you get to pages that doesn't exist.

SEO Smart Links

SEO Smart links is a cool plugin allows you to specify a word and then link it to a post on your site. Then each time the word appears on your site, its automatically turned into a link you specified