css3 :not(selector) selector

The :not(selector) selector is used for selecting elements that are NOT the specified element/selector.
it means that the condition matches every element that is NOT the specified element/selector.
syntax of :not selector
:not(selector) { style properties } 
Sample usage of the :not selector.
if you want a paragraph's background in green,
we would apply this
p
{ 
background:green;
} 

Assume you have a paragraph and two div,s in your page,
so you want to apply green background to all those elements that are not <p> element.
:not(p)
{
background:#ff0000;
} 

it tells browser that to select all elements that are not <p> element.
and to apply this style to all elements except <p> tags in webpage.

The :not selector is supported in all major browsers but  IE8 and earlier do not support the :not selector.

Here is some examples on using css3 :not() selector.

Select all elements that are not the specified element

:not(element)
{
…..
}

Example: :
:not(p)
{
background:green;
} 

All elements than <p> elements will be with a green background.

Select all elements that are not the elements with specified class.

:not(.classname)
{
…..
} 

Example: :
:not(.myClass)
{
background:green;
} 

All elements than the elements with a class of myClass will be with a green background.

Select all elements that are not the element with specified ID.

:not(#elementID)
{
…..
} 

Example: :
:not(#myDiv)
{
background:green;
} 

All elements than the element with an ID of myDiv will be with a green background.

Select all BUTTONS that are not DISABLED.

button:not([DISABLED])
{
…..
} 

Select all elements but NOT <element-tag>.

*:not(element-tag)
{
…..
} 

Example: :
:not(img)
{
background:green;
} 

All elements than the element  <img> will be with a green background.

Selects all HTML elements except links.

html|*:not(:link):not(:visited)
{
….
}

Selects all  elements that are not being hovered.

*|*:not(:hover)
{
…..
}

Selects all  <a> elements that are not with a base  HREF that holds specific URL .

a:not([href^="URL"]) 
{ 
----
} 

Example::
a:not([href^=http://aslamise.blogspot.com]) 
{ 
border: 1px solid green; 
} 

Selects all <a> elements that have a rel=”external”.

a[rel~="external"] 
{ 
…..
}

Selects all  elements that have a name=”name” attribute, but eclude one that contain “name”.

element[name*="name"]:not([name="name-that-not-to-removed"])
{
…..
}

on hover an element that doesn't have  the class “.class-name”

element-tag:not(.class-name):hover 
{
……
}

Example:
li:not(.active):hover
{
background:green;
}

If you are using jQuery  to apply css3 effect in your webpage, :not() elector will be more useful.







Read Article →

How to reset CSS for only a DIV or any other html element -Simple solution!

The aim of a CSS reset is to prevent inconsistency of elements that is nested to other elements,by reseting the height,width,margin,etc styles to the default ones.
there are many ways to reset style of an elemet to the specific one.
one solution is to add a !important after the style attribute. like h1{font-size:25px!important;}
and another is to overwrite each element style to the default one.
and another is to use an css reset stylesheet to reset.
Finest solution is to use a css reset tool. Below is Aslamise Css reset script. You may have to tweak a little if you find anything that doesnt suits your needs.
.aslamise-css-reset html{color:#000;background:#FFF;}.aslamise-css-reset body,.aslamise-css-reset div,.aslamise-css-reset dl,.aslamise-css-reset dt,.aslamise-css-reset dd,.aslamise-css-reset ul,.aslamise-css-reset ol,.aslamise-css-reset li,.aslamise-css-reset h1,.aslamise-css-reset h2,.aslamise-css-reset h3,.aslamise-css-reset h4,.aslamise-css-reset h5,.aslamise-css-reset h6,.aslamise-css-reset pre,.aslamise-css-reset code,.aslamise-css-reset form,.aslamise-css-reset fieldset,.aslamise-css-reset legend,.aslamise-css-reset input,.aslamise-css-reset textarea,.aslamise-css-reset p,.aslamise-css-reset blockquote,.aslamise-css-reset th,.aslamise-css-reset td{margin:0;padding:0}.aslamise-css-reset table{border-collapse:collapse;border-spacing:0}.aslamise-css-reset fieldset,.aslamise-css-reset img{border:0}.aslamise-css-reset address,.aslamise-css-reset caption,.aslamise-css-reset cite,.aslamise-css-reset code,.aslamise-css-reset dfn,.aslamise-css-reset em,.aslamise-css-reset strong,.aslamise-css-reset th,.aslamise-css-reset var{font-style:normal;font-weight:normal}.aslamise-css-reset ol,.aslamise-css-reset ul{list-style:none}.aslamise-css-reset li{list-style:none}.aslamise-css-reset caption,.aslamise-css-reset th{text-align:left}.aslamise-css-reset h1,.aslamise-css-reset h2,.aslamise-css-reset h3,.aslamise-css-reset h4,.aslamise-css-reset h5,.aslamise-css-reset h6{font-size:100%;font-weight:normal}.aslamise-css-reset q:before,.aslamise-css-reset q:after{content:''}.aslamise-css-reset abbr,.aslamise-css-reset acronym{border:0;font-variant:normal}.aslamise-css-reset sup{vertical-align:text-top}.aslamise-css-reset sub{vertical-align:text-bottom}.aslamise-css-reset input,.aslamise-css-reset textarea,.aslamise-css-reset select{font-family:inherit;font-size:inherit;font-weight:inherit}.aslamise-css-reset input,.aslamise-css-reset textarea,.aslamise-css-reset select{*font-size:100%}.aslamise-css-reset legend{color:#000}.aslamise-css-reset *{background:none;color:black;} Lets take a look at it.
  • This is a ul li block where no class assigned

  • This is a ul li block where aslamise-css-reset assigned


So , lets see how to use this css reset in your page. Copy and paste above css reset code in your stylesheet at the bottom of stylesheet. Then add class "aslamise-css-reset" to the element where you want to reset your css. Example: <ul class='aslamise-css-reset'><li>This is a ul li block where aslamise-css-reset assigned</li></ul> If you want to see another example, see previous post's "demo", where aslamise-css-reset class enabled!.

Read Article →

Simple Tutorial: How to use jQuery&CSS to show or hide tab contents without page jump

While making elements in your website or blog 'beautiful and easy to navigate', you will have to adjust elements in an order.
 Here we going to lean how to set up a navigation system which shows single section's content at a time as per user condition and where a group of multiple sections exist,without page jump.
just like the example below.


Contents in tab 1 section
Contents in tab 2 section
Contents in tab 3 section


So here we go. Hope you have understanding of jQuery, CSS,and HTML.
 First, lets make our navigation menu for calling tabs.
  <div> <ul class="nav nav-tabs"> <li class="active"> <a href="#tab1">tab 1</a> </li> <li> <a href="#tab2">tab 2</a> </li> <li> <a href="#tab3">tab 3</a> </li> </ul> </div> 

Then next to that, lets setup our sections where each section will have id like tab1,tab2,tab3 in this order.
  <section id='tab1' class="tab-content active"> Contents in tab 1 section </section> <section id='tab2' class="tab-content hide"> Contents in tab 2 section </section> <section id='tab3' class="tab-content hide"> Contents in tab 3 section </section> 

Now, lets style our navigation menu and sections with CSS
  <style type='text/css'> .nav { margin-bottom: 18px; margin-left: 0; list-style: none; } .nav > li > a { display: block; } .nav-tabs{ *zoom: 1; } .nav-tabs:before, .nav-tabs:after { display: table; content: ""; } .nav-tabs:after { clear: both; } .nav-tabs > li { float: left; } .nav-tabs > li > a { padding-right: 12px; padding-left: 12px; margin-right: 2px; line-height: 14px; } .nav-tabs { border-bottom: 1px solid #ddd; } .nav-tabs > li { margin-bottom: -1px; } .nav-tabs > li > a { padding-top: 8px; padding-bottom: 8px; line-height: 18px; border: 1px solid transparent; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover { border-color: #eeeeee #eeeeee #dddddd; } .nav-tabs > .active > a, .nav-tabs > .active > a:hover { color: #555555; cursor: default; background-color: #ffffff; border: 1px solid #ddd; border-bottom-color: transparent; } li { line-height: 18px; } .tab-content.active{ display: block; } .tab-content.hide{ display: none; } </style> 

Next, we need to Call jQuery, if you have already called jQuery in your document, then skip this step.
  <script type='text/javascript' src='//code.jquery.com/jquery-1.8.3.js'></script> 

Now, the last step, We have to display our tab2 section when we click on it. same time we have to hide the other tabs. 
 Our jQuery code is below

  <script type='text/javascript'> $(document).ready(function() { $('.nav-tabs > li > a').click(function(event){ event.preventDefault();//stop browser to take action for clicked anchor //get displaying tab content jQuery selector var active_tab_selector = $('.nav-tabs > li.active > a').attr('href'); //find actived navigation and remove 'active' css var actived_nav = $('.nav-tabs > li.active'); actived_nav.removeClass('active'); //add 'active' css into clicked navigation $(this).parents('li').addClass('active'); //hide displaying tab content $(active_tab_selector).removeClass('active'); $(active_tab_selector).addClass('hide'); //show target tab content var target_tab_selector = $(this).attr('href'); $(target_tab_selector).removeClass('hide'); $(target_tab_selector).addClass('active'); }); }); </script> 

We are done! Go play with it. 
 Here is a sample demo you can play with ! 

http://jsfiddle.net/Aslamise/Qt7jx/

Read Article →

Beautiful jQuery tooltip



  • Tool-tips are title of the element which displays when a user hover on same element.
  • There are many plugins available to make tool-tips more beautiful but i prefer this one because it can be customized as we wish and it is compatible with almost all major web browsers.
  • What tool-tip plugins do is , Calling the title attribute's value and displays it on the customized html design.
  • jQuery tooltipster is highly customization enabled plugin. in this article, i have also covered something that will be helpful to change the direction of tool-tip arrow just by assigning class than the default one's.
  • we can use tool-tip on top the element, right side of the element,left side of the element,top left side of the element,top right side of the element,or bottom,bottom right or bottom left of the element.
  • all you have to do is just add this to your website or blog and to assign the needed class to element which has a title attribute with some value in it.

  • Here is a live demo that you can understand how this plugin works.
     To add this beautiful jQuery tool-tip plugin to your blog or website, follow instructions below.
    1Call style-sheet or internal style block between <head></head> tags. <link rel="stylesheet" type="text/css" href="path-to/css/tooltipster.css" /> OR   <style type='text/css'> .tooltipster-chocolate { background-color: #7f5d3c; border: 2px solid #5c3d1f; color: #fafaeb; font-family: Arial, sans-serif; font-size: 12px; line-height: 12px; position: absolute; padding: 10px; border-radius: 4px; text-align: center; z-index: 9999999; pointer-events: none; width: auto; overflow: visible; } .tooltipster-chocolate .tooltip-arrow { text-shadow: 0px 2px 0px #654728, 1px 1px 0px #654728, -1px 1px 0px #654728; } .tooltipster-clean-cut { background-color: #f9f9f9; border: 1px solid #dadada; box-shadow: inset 0px 1px 0px #fff; color: #595959; font-family: Arial, sans-serif; font-size: 12px; line-height: 12px; position: absolute; padding: 10px; border-radius: 4px; text-align: center; z-index: 9999999; pointer-events: none; width: auto; overflow: visible; } .tooltipster-clean-cut .tooltip-arrow { text-shadow: 0px 2px 0px #dadada, 0px 1px 0px #dadada; } .tooltipster-smoke { background-color: #111; border: 2px solid black; border-radius: 6px; box-shadow: 5px 5px 7px #444; opacity: 0.7; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70); color: white; font-family: Arial, sans-serif; font-weight: bold; font-size: 12px; line-height: 12px; position: absolute; padding: 10px; text-align: center; z-index: 9999999; pointer-events: none; width: auto; overflow: visible; } .tooltipster-smoke .tooltip-arrow { text-shadow: 5px 5px 7px #444; } /* This is the default styling for all Tooltipsters: */ .tooltip-message { background: #000; /* <- for IE */ background: rgba(0,0,0,0.9); color: #fff; font-family: Arial, sans-serif; font-size: 12px; line-height: 12px; position: absolute; padding: 10px; border-radius: 2px; text-align: center; z-index: 9999999; pointer-events: none; width: auto; overflow: visible; word-wrap:break-word; } /* When you want to create a second class for your Tooltipster messages, copy (or modify) this template and add your style to it. Don't forget to refer to it in your Tooltipster settings (tooltipClass: '.my-custom-theme') */ .my-custom-theme { position: absolute; text-align: center; z-index: 9999999; pointer-events: none; width: auto; /* Start styling here... */ } /* Add a slight border radius to all images inside the Tooltipsters */ .tooltip-message img { border-radius: 2px; } /* These next classes handle the styles for the little arrow attached to the tooltip. If you need to change the color of the arrow to match a custom Tooltipster theme, set it in your Tooltipster settings (arrowColor: '#yourcolor') */ .tooltip-arrow { display: block; text-align: center; font-size: 12px; line-height: 12px; width: 100%; height: 5px; position: absolute; left: 0px; z-index: -1; } .tooltip-arrow-top { bottom: -3px; margin: 0 auto; text-align: center; } .tooltip-arrow-top-right { bottom: -3px; margin-left: -10px; text-align: right; } .tooltip-arrow-top-left { bottom: -3px; margin-left: 10px; text-align: left; } .tooltip-arrow-bottom { top: -10px; margin: 0 auto; text-align: center; } .tooltip-arrow-bottom-right { top: -10px; margin-left: -10px; text-align: right; } .tooltip-arrow-bottom-left { top: -10px; margin-left: 10px; text-align: left; } .tooltip-arrow-left { top: 0px; right: -18px; margin: 0 auto; text-align: right; } .tooltip-arrow-right { top: 0px; left: -8px; margin: 0 auto; text-align: left; } /* Some styling to enable the slide animation */ .tooltip-slide { height: 0px; position: absolute; width: auto; z-index: 9999999; overflow: hidden; } </style> 
    2Add jQuery. if you have already called jQuery before, skip this step
      &lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.8.0.min.js&quot;&gt;&lt;/script&gt; 
    3 Call External jQuery plugin script or insert code block between <head></head> tags.
    <script type="text/javascript" src="http://aslamise.googlecode.com/files/jquery.tooltipster.min.js"></script>
    OR
    <script type='text/javascript'>//<![CDATA[ $(window).load(function(){ (function( $ ) { $.fn.tooltipster = function( options ) { var settings = $.extend({ animation: 'fade', arrow: true, arrowColor: '', delay: 200, fixedWidth: 0, followMouse: false, offsetX: 0, offsetY: 0, overrideText: '', position: 'top', speed: 100, timer: 0, tooltipTheme: '.tooltip-message' }, options); function animateOut(tooltipToKill) { if(settings.animation == 'slide') { $(tooltipToKill).slideUp(settings.speed, function() { $(tooltipToKill).remove(); $("body").css("overflow-x", "auto"); }); } else { $(tooltipToKill).fadeOut(settings.speed, function() { $(tooltipToKill).remove(); $("body").css("overflow-x", "auto"); }); } } return this.hover(function() { if ($(settings.tooltipTheme).not('.tooltip-kill').length == 1) { animateOut($(settings.tooltipTheme).not('.tooltip-kill')); $(settings.tooltipTheme).not('.tooltip-kill').addClass('tooltip-kill'); } $("body").css("overflow-x", "hidden"); var tooltip_text = $(this).attr('title'); $(this).attr('title', ''); $(this).data('title', tooltip_text); if($.trim(settings.overrideText).length > 0) { var tooltip_text = settings.overrideText; } if(settings.fixedWidth > 0) { var fixedWidth = ' style="width:'+ settings.fixedWidth +'px;"'; } else { var fixedWidth = ''; } $('<div class="'+ settings.tooltipTheme.replace('.','') +'"'+ fixedWidth +'><div class="tooltip-message-content">'+tooltip_text+'</div></div>').appendTo('body').hide(); if (settings.followMouse == false) { var window_width = $(window).width(); var container_width = $(this).outerWidth(false); var container_height = $(this).outerHeight(false); var tooltip_width = $(settings.tooltipTheme).not('.tooltip-kill').outerWidth(false); var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false); var offset = $(this).offset(); if(settings.fixedWidth == 0) { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'width': tooltip_width + 'px', 'padding-left': '0px', 'padding-right': '0px' }); } function dont_go_off_screen() { var window_left = $(window).scrollLeft(); if((my_left - window_left) < 0) { var arrow_reposition = my_left - window_left; my_left = window_left; $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', arrow_reposition); } if (((my_left + tooltip_width) - window_left) > window_width) { var arrow_reposition = my_left - ((window_width + window_left) - tooltip_width); my_left = (window_width + window_left) - tooltip_width; $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', arrow_reposition); } } if(settings.position == 'top') { var left_difference = (offset.left + tooltip_width) - (offset.left + $(this).outerWidth(false)); var my_left = (offset.left + settings.offsetX) - (left_difference / 2); var my_top = (offset.top - tooltip_height) - settings.offsetY - 10; dont_go_off_screen(); if((offset.top - tooltip_height - settings.offsetY - 11) < 0) { var my_top = 0; } } if(settings.position == 'top-left') { var my_left = offset.left + settings.offsetX; var my_top = (offset.top - tooltip_height) - settings.offsetY - 10; dont_go_off_screen(); } if(settings.position == 'top-right') { var my_left = (offset.left + container_width + settings.offsetX) - tooltip_width; var my_top = (offset.top - tooltip_height) - settings.offsetY - 10; dont_go_off_screen(); } if(settings.position == 'bottom') { var left_difference = (offset.left + tooltip_width + settings.offsetX) - (offset.left + $(this).outerWidth(false)); var my_left = offset.left - (left_difference / 2); var my_top = (offset.top + container_height) + settings.offsetY + 10; dont_go_off_screen(); } if(settings.position == 'bottom-left') { var my_left = offset.left + settings.offsetX; var my_top = (offset.top + container_height) + settings.offsetY + 10; dont_go_off_screen(); } if(settings.position == 'bottom-right') { var my_left = (offset.left + container_width + settings.offsetX) - tooltip_width; var my_top = (offset.top + container_height) + settings.offsetY + 10; dont_go_off_screen(); } if(settings.position == 'left') { var my_left = offset.left - settings.offsetX - tooltip_width - 10; var my_left_mirror = offset.left + settings.offsetX + container_width + 10; var top_difference = (offset.top + tooltip_height + settings.offsetY) - (offset.top + $(this).outerHeight(false)); var my_top = offset.top - (top_difference / 2); if((my_left < 0) && ((my_left_mirror + tooltip_width) > window_width)) { my_left = my_left + tooltip_width; } if(my_left < 0) { var my_left = offset.left + settings.offsetX + container_width + 10; $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', 'left'); } } if(settings.position == 'right') { var my_left = offset.left + settings.offsetX + container_width + 10; var my_left_mirror = offset.left - settings.offsetX - tooltip_width - 10; var top_difference = (offset.top + tooltip_height + settings.offsetY) - (offset.top + $(this).outerHeight(false)); var my_top = offset.top - (top_difference / 2); if(((my_left + tooltip_width) > window_width) && (my_left_mirror < 0)) { my_left = window_width - tooltip_width; } if((my_left + tooltip_width) > window_width) { my_left = offset.left - settings.offsetX - tooltip_width - 10; $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', 'right'); } } } if (settings.followMouse == true) { var tooltip_width = $(settings.tooltipTheme).not('.tooltip-kill').outerWidth(false); var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false); var tooltip_content = $(settings.tooltipTheme).not('.tooltip-kill').find('.tooltip-message-content').html(); $(this).mousemove(function(e){ $(settings.tooltipTheme).not('.tooltip-kill').find('.tooltip-message-content').html('').html(tooltip_content); var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false); if(settings.position == 'top') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': ((e.pageX - 1) - (tooltip_width / 2) + settings.offsetX) + 'px', 'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px' }); } if(settings.position == 'top-right') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': e.pageX - 8 + settings.offsetX + 'px', 'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px' }); } if(settings.position == 'top-left') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': (e.pageX - tooltip_width + settings.offsetX) + 7 + 'px', 'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px' }); } if(settings.position == 'bottom') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': (e.pageX - (tooltip_width / 2) + settings.offsetX - 1) + 'px', 'top': (e.pageY + 15 + settings.offsetY + 10) + 'px' }); } if(settings.position == 'bottom-right') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': e.pageX - 2 + settings.offsetX + 'px', 'top': (e.pageY + 15 + settings.offsetY + 10) + 'px' }); } if(settings.position == 'bottom-left') { $(settings.tooltipTheme).not('.tooltip-kill').css({ 'left': (e.pageX - tooltip_width + settings.offsetX) + 12 + 'px', 'top': (e.pageY + 15 + settings.offsetY + 10) + 'px' }); } }); } if (settings.arrow == true){ var arrow_class = 'tooltip-arrow-' + settings.position; if (settings.followMouse == true) { if(arrow_class.search('right') > 0) { var temp_arrow_class = arrow_class; arrow_class = temp_arrow_class.replace('right', 'left'); } else { var temp_arrow_class = arrow_class; arrow_class = temp_arrow_class.replace('left', 'right'); } } if(arrow_class == 'tooltip-arrow-right') { var arrow_type = '◀'; var arrow_vertical = 'top:' + ((tooltip_height / 2) - 5) + 'px'; } if(arrow_class == 'tooltip-arrow-left') { var arrow_type = '▶'; var arrow_vertical = 'top:' + ((tooltip_height / 2) - 4) + 'px'; } if(arrow_class.search('top') > 0) { var arrow_type = '▼'; } if(arrow_class.search('bottom') > 0) { var arrow_type = '▲'; } if(settings.arrowColor.length < 1) { var arrow_color = $(settings.tooltipTheme).not('.tooltip-kill').css('background-color'); } else { var arrow_color = settings.arrowColor; } var arrow_reposition = $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition'); if (!arrow_reposition) { arrow_reposition = ''; } else if (arrow_reposition == 'left') { arrow_class = 'tooltip-arrow-right'; arrow_type = '◀'; arrow_reposition = ''; } else if (arrow_reposition == 'right') { arrow_class = 'tooltip-arrow-left'; arrow_type = '▶'; arrow_reposition = ''; } else { arrow_reposition = 'left:'+ arrow_reposition +'px;'; } var arrow = '<div class="'+ arrow_class +' tooltip-arrow" style="color:'+ arrow_color +'; width:'+ tooltip_width +'px; display:none; '+ arrow_reposition +' '+ arrow_vertical +'">'+ arrow_type +'</div>'; } else { var arrow = ''; } $(settings.tooltipTheme).not('.tooltip-kill').css({'top': my_top+'px', 'left': my_left+'px'}).append(arrow); if(settings.animation == 'slide') { $(settings.tooltipTheme).not('.tooltip-kill').delay(settings.delay).slideDown(settings.speed, function() { $('.tooltip-arrow').fadeIn(settings.speed); }); if(settings.timer > 0) { $(settings.tooltipTheme).not('.tooltip-kill').delay(settings.timer).slideUp(settings.speed); } } else { $('.tooltip-arrow').show(); $(settings.tooltipTheme).not('.tooltip-kill').delay(settings.delay).fadeIn(settings.speed); if(settings.timer > 0) { $(settings.tooltipTheme).not('.tooltip-kill').delay(settings.timer).fadeOut(settings.speed); } } }, function() { $(settings.tooltipTheme).not('.tooltip-kill').clearQueue(); tooltip_text = $(this).data('title'); $(this).attr('title', tooltip_text); $(settings.tooltipTheme).addClass('tooltip-kill'); animateOut('.tooltip-kill'); }); } })( jQuery ); $(document).ready(function() { $('.tpt').tooltipster({fixedWidth: 200,position: 'top'}); $('.tpb').tooltipster({fixedWidth: 200,position: 'bottom'}); $('.tpl').tooltipster({fixedWidth: 200,position: 'left'}); $('.tpr').tooltipster({fixedWidth: 200,position: 'right'}); $('.tptl').tooltipster({fixedWidth: 200,position: 'top-left'}); $('.tptr').tooltipster({fixedWidth: 200,position: 'top-right'}); $('.tpbl').tooltipster({fixedWidth: 200,position: 'bottom-left'}); $('.tpbr').tooltipster({fixedWidth: 200,position: 'bottom-right'}); }); });//]]> </script>
    4Now , lets test it.
    Paste this anywhere in your blog or website's source code.
     <a class='tpb' title='my awesome tooltip'>Tooltip</a>
    
     (Please note that if you are using original tooltipster Code for this,then the classes always be 'tooltip',and if you are using script above,then it can be tpt,tpb,tpl,tpr,tptl,tptr,tpbl,tpbr- as you can specify the direction of the tooltip )
     If everything works ,please be kind to tell it in comments, else start a discussion and find your solution.
     Or you can go to tooltipster's project page and follow their instructions. they have made an easy guide for beginners
    http://calebjacob.com/tooltipster/#getting-started

    Read Article →

    Facebook buttons with CSS


    Facebook  has a nice collection of buttons those are simple but really nice. Facebook ui like buttons are really awesome.
    So how can you include Facebook like CSS buttons into your website or blog?
    it is so simple . you have to insert CSS style code to your header section and you can make any button or element with adding a  class to that.

    Here is a live demo.

    Buttons







    Buttons Group


    Buttons Toolbar



    Here is the HTML Code i have used for this demo

    <h1>Buttons</h1>
    <button class='uibutton'>button</button>
    <button class='uibutton large'>button large</button>
    <br/>
    <br/>
    <button class='uibutton confirm'>confirm button</button>
    <button class='uibutton confirm large'>confirm button large</button>
    <br/>
    <br/>
    <button class='uibutton special'>special button</button>
    <button class='uibutton special large'>special button large</button>
    <br/>
    <br/>
    <h1>Buttons Group</h1>
    <div class='uibutton-group'>
    <button class='uibutton'>button</button>
    <button class='uibutton confirm'>button</button>
    <button class='uibutton special'>button</button>
    </div>
    <br/>
    <br/>
    <h1>Buttons Toolbar</h1>
    <div class='uibutton-toolbar'>
    <button class='uibutton'>button</button>
    <button class='uibutton'>button</button>
    </div>


    And here goes the CSS style

    <style type='text/css'>
    .uibutton {
    position: relative;
    z-index: 1;
    overflow: visible;
    display: inline-block;
    padding: 0.3em 0.6em 0.375em;
    border: 1px solid #999;
    border-bottom-color: #888;
    margin: 0;
    text-decoration: none;
    text-align: center;
    font: bold 11px/normal 'lucida grande', tahoma, verdana, arial, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    /* outline: none; */
    color: #333;
    background-color: #eee;
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f6f6), to(#e4e4e3));
    background-image: -moz-linear-gradient(#f5f6f6, #e4e4e3);
    background-image: -o-linear-gradient(#f5f6f6, #e4e4e3);
    background-image: linear-gradient(#f5f6f6, #e4e4e3);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f5f6f6', EndColorStr='#e4e4e3'); /* for IE 6 - 9 */
    -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #fff;
    -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #fff;
    /* IE hacks */
    zoom: 1;
    *display: inline;
    }

    .uiButton{cursor:pointer;display:inline-block;font-size:11px;font-weight:bold;line-height:13px;padding:2px 6px;text-align:center;text-decoration:none;vertical-align:top;white-space:nowrap}
    .uiButton, .uiButtonSuppressed:active, .uiButtonSuppressed:focus, .uiButtonSuppressed:hover{background-image:url(//m-static.ak.fbcdn.net/rsrc.php/v2/ys/x/t0WxoMd7EqC.png);background-repeat:no-repeat;background-size:auto;background-position:-352px -401px;background-color:#eee;border:1px solid #999;border-bottom-color:#888;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, .1)}
    .uiButton + .uiButton{margin-left:4px}
    .uiButton:hover{text-decoration:none}
    .uiButton:active, .uiButtonDepressed{background:#ddd;border-bottom-color:#999;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, .2)}
    .uiButton .img{margin-top:2px;vertical-align:top}

    .uibutton:hover,
    .uibutton:focus,
    .uibutton:active {
    border-color: #777 #777 #666;
    }

    .uibutton a:hover{
    text-decoration:none;
    }
    .uibutton:active {
    border-color: #aaa;
    background: #ddd;
    filter: none;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    }

    /* overrides extra padding on button elements in Firefox */
    .uibutton::-moz-focus-inner {
    padding: 0;
    border: 0;
    }

    /* ............................................................................................................. Icons */

    .uibutton.icon:before {
    content: "";
    position: relative;
    top: 1px;
    float:left;
    width: 10px;
    height: 12px;
    margin: 0 0.5em 0 0;
    background: url(fb-icons.png) 99px 99px no-repeat;
    }

    .uibutton.edit:before { background-position: 0 0; }
    .uibutton.add:before { background-position: -10px 0; }
    .uibutton.secure:before { background-position: -20px 0; }
    .uibutton.prev:before { background-position: -30px 0; }
    .uibutton.next:before { float:right; margin: 0 -0.25em 0 0.5em; background-position: -40px 0; }

    /* ------------------------------------------------------------------------------------------------------------- BUTTON EXTENSIONS */

    /* ............................................................................................................. Large */

    .uibutton.large {
    font-size:13px;
    }

    /* ............................................................................................................. Submit, etc */

    .uibutton.confirm {
    border-color: #29447E #29447E #1A356E;
    color: #fff;
    background-color: #5B74A8;
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#637bad), to(#5872a7));
    background-image: -moz-linear-gradient(#637bad, #5872a7);
    background-image: -o-linear-gradient(#637bad, #5872a7);
    background-image: linear-gradient(#637bad, #5872a7);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#637bad', EndColorStr='#5872a7'); /* for IE 6 - 9 */
    -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #8a9cc2;
    -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #8a9cc2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #8a9cc2;
    }

    .uibutton.confirm:active {
    border-color: #29447E;
    background: #4F6AA3;
    filter: none;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    }

    /* ............................................................................................................. Special */

    .uibutton.special {
    border-color: #3b6e22 #3b6e22 #2c5115;
    color: #fff;
    background-color: #69A74E;
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#75ae5c), to(#67a54b));
    background-image: -moz-linear-gradient(#75ae5c, #67a54b);
    background-image: -o-linear-gradient(#75ae5c, #67a54b);
    background-image: linear-gradient(#75ae5c, #67a54b);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#75ae5c', EndColorStr='#67a54b'); /* for IE 6 - 9 */
    -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #98c286;
    -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #98c286;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 #98c286;
    }

    .uibutton.special:active {
    border-color: #3B6E22;
    background: #609946;
    filter: none;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    }


    /* ------------------------------------------------------------------------------------------------------------- BUTTON GROUPS */

    .uibutton-group {
    display: inline-block;
    list-style: none;
    padding: 0;
    margin: 0;
    /* IE hacks */
    zoom: 1;
    *display: inline;
    }

    .uibutton + .uibutton,
    .uibutton + .uibutton-group,
    .uibutton-group + .uibutton,
    .uibutton-group + .uibutton-group {
    margin-left: 3px;
    }

    .uibutton-group li {
    float: left;
    padding: 0;
    margin: 0;
    }

    .uibutton-group .uibutton {
    float: left;
    margin-left: -1px;
    }

    .uibutton-group .uibutton:hover,
    .uibutton-group .uibutton:focus,
    .uibutton-group .uibutton:active {
    z-index:2;
    }

    .uibutton-group > .uibutton:first-child,
    .uibutton-group li:first-child .uibutton {
    margin-left: 0;
    }

    /* ------------------------------------------------------------------------------------------------------------- BUTTON CONTAINER */
    /* For mixing buttons and button groups, e.g., in a navigation bar */

    .uibutton-toolbar {
    padding: 6px;
    border-top: 1px solid #ccc;
    background: #f2f2f2;
    }

    .uibutton-toolbar .uibutton,
    .uibutton-toolbar .uibutton-group {
    vertical-align: bottom;
    }
    </style>


    And here is a demo you can play with :

    http://jsfiddle.net/Aslamise/KEbFU/

    Hope this helps.
    feel free to discuss about this :)

    Read Article →

    Altrernative for marquee tag - with webkit animation

    You can see a live demo in this page for alternative of marquee tag in webkit browsers with speed control.
    Aslamise.blogspot.com - Aslam's little place on the clouds! - By Muhammed Aslam C


    Here is the basic markup for the demo you are seeing.
    <div id="outer">
     <div id="inner">Aslamise.blogspot.com <b>Aslam's little place on the clouds!</b><b>By Muhammed Aslam C</b></div>
    </div

    And here goes the CSS to do the animation in web-kit browsers



    <style type="text/css">
     @-webkit-keyframes bar { 0% { left: 100% } 100% { left: -200% }}#outer {
     height: 24px;
     overflow: hidden;
     background: #fff;
     background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#dfdfdf));
     position: fixed;
     top: 0px;
     right: 0px;
     width: 100%;
     z-index: 9999;
    }
    #inner {
     height: 24px;
     width: 200%;
     position: relative;
     font: 20px Helvetica;
     line-height: 26px;
     text-transform: uppercase;
     text-shadow: #fdfdfd 0 1px 0;
     -webkit-animation: bar 25s infinite linear;}
    </style>


    Here i have marked two style blocks in yellow background.
    This is where we tell to browser to do a marquee like animation.


     @-webkit-keyframes bar {
     0% { left: 100% }
     100% { left: -200% }
    }

    Above we declared is animation : named as bar, which will move the element from left 100% to left 200% , and it will do the trick.

    Next step is to add animation  to any element we want to.
    . inner{
     -webkit-animation: bar 25s infinite linear;
    }

    element with a class of "inner" will call the animation, for an infinite loop in the speed of 12 seconds. you can change the "25s" to any. Higher the value, animation will be slow.


    Read Article →

    Nice and beautiful paging buttons with CSS

    Here is how you can create nice and beautiful paging buttons with css. Below is a live demo.






    Here is the souce code and explanations for this stylish paging buttons.

    Basic markup code for our paging button goes like this.



    <ul id="pagin">
    <li><a class="current" href="#">1</a></li>
    <li><a href="#">2</a></li>
    <li><a href="#">3</a></li>
    <li><a href="#">4</a></li>
    <li><a href="#">next</a></li>
    </ul>




    And here is the CSS code that makes our paging buttons more beautiful.



    <style type='text/css'>
    #pagin {
    margin: 65px auto;
    padding: 0;
    list-style: none;
    width: 180px;
    }
    #pagin li {
    float: left;
    margin-right: 10px;
    }
    #pagin li a {
    display: block;
    text-decoration: none;
    color: #717171;
    font: bold 11px Arial, sans-serif;
    text-shadow: 0px 1px white;
    padding: 5px 8px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.35);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.35);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.35);
    background: #f9f9f9;
    background: -webkit-linear-gradient(top, #f9f9f9 0%, #e8e8e8 100%);
    background: -moz-linear-gradient(top, #f9f9f9 0%, #e8e8e8 100%);
    background: -o-linear-gradient(top, #f9f9f9 0%, #e8e8e8 100%);
    background: -ms-linear-gradient(top, #f9f9f9 0%, #e8e8e8 100%);
    background: linear-gradient(top, #f9f9f9 0%, #e8e8e8 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#e8e8e8',GradientType=0 );
    }
    #pagin li a.current {
    color: white;
    text-shadow: 0px 1px #3f789f;
    -webkit-box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.8);
    -moz-box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.8);
    box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.8);
    background: #7cb9e5;
    background: -webkit-linear-gradient(top, #7cb9e5 0%, #57a1d8 100%);
    background: -moz-linear-gradient(top, #7cb9e5 0%, #57a1d8 100%);
    background: -o-linear-gradient(top, #7cb9e5 0%, #57a1d8 100%);
    background: -ms-linear-gradient(top, #7cb9e5 0%, #57a1d8 100%);
    background: linear-gradient(top, #7cb9e5 0%, #57a1d8 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7cb9e5', endColorstr='#57a1d8',GradientType=0 );
    }
    #pagin li a:hover {
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.55);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.55);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.55);
    background: #fff;
    background: -webkit-linear-gradient(top, #fff 0%, #e8e8e8 100%);
    background: -moz-linear-gradient(top, #fff 0%, #e8e8e8 100%);
    background: -o-linear-gradient(top, #fff 0%, #e8e8e8 100%);
    background: -ms-linear-gradient(top, #fff 0%, #e8e8e8 100%);
    background: linear-gradient(top, #fff 0%, #e8e8e8 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#e8e8e8',GradientType=0 );
    }
    #pagin li a:active,#pagin li a.current:active {
    -webkit-box-shadow: inset 0px 1px 3px 0px rgba(0,0,0,0.5), 0px 1px 1px 0px rgba(255,255,255,1) !important;
    -moz-box-shadow: inset 0px 1px 3px 0px rgba(0,0,0,0.5), 0px 1px 1px 0px rgba(255,255,255,1) !important;
    box-shadow: inset 0px 1px 3px 0px rgba(0,0,0,0.5), 0px 1px 1px 0px rgba(255,255,255,1) !important;
    }
    #pagin li a.current:hover {
    -webkit-box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.9);
    -moz-box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.9);
    box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.9);
    background: #99cefc;
    background: -webkit-linear-gradient(top, #99cefc 0%, #57a1d8 100%);
    background: -moz-linear-gradient(top, #99cefc 0%, #57a1d8 100%);
    background: -o-linear-gradient(top, #99cefc 0%, #57a1d8 100%);
    background: -ms-linear-gradient(top, #99cefc 0%, #57a1d8 100%);
    background: linear-gradient(top, #99cefc 0%, #57a1d8 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#99cefc', endColorstr='#57a1d8',GradientType=0 );
    }
    </style>







    Read Article →

    Nice button with hover effect with CSS

    To make your website more beautiful, you will have to make up each element beautiful with CSS. Button is one of them. in this tutorial, i would like to demonstrate how to create a nice button with  shadow effects when hover on it,that too with an transition effect.




    Here is the Html code for above button.

    <button class="ui-button" tabindex="0">This is a button</button>

    <button><button>

    This is the markup tag for creating a button in html.
    And we assign a class for that button so we can call that class in our css for making it more beautiful

    tabindex="0"
    This property is set if there are many elements that a user can navigate with the tab key in keyboard.
    the next button's tabindex will be set as
    tabindex="1" and so on.

    And now here is the CSS code used for above button.

    <style type='text/css'>

    button.ui-button {
    background: -webkit-gradient(linear, left top, left bottom, from(whiteSmoke), to(#F1F1F1));
    -webkit-border-radius: 2px;
    -webkit-transition: all 0.2s;
    -webkit-box-sizing: content-box;
    -webkit-box-align: stretch;
    -webkit-user-select: none;
    }

    button.ui-button {
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #222;
    cursor: pointer;
    height: 27px;
    padding: 0 10px;
    line-height: 26px;
    margin: 0;
    text-align: center;
    box-sizing: content-box;
    vertical-align: middle;
    font-size: 11px;
    font-weight: bold;
    position: relative;
    }

    button.ui-button:hover {
    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    -webkit-transition: all 0;
    background: -webkit-gradient(linear, left top, left bottom, from(#F8F8F8), to(#F1F1F1));
    }
    button.ui-button:hover {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #222;
    text-decoration: none;
    }

    </style>




    Read Article →

    Center Align an image or div inside another div

    To center position an image or div inside another div or exactly in the main page container, we can use CSS.

    You might be aware of text-align:center; Css code will do the trick if you only need to position an image or another div inside a big div horizontally (right to left).
    But for vertical alignment, it would be a problem.

    Solution 1:


    If you are trying to display an image inside another div exactly in center, you could set it as the background image and align it to center of the div.

    For Example.
    Assume that You have a div with id #BigDiv.
    and you want to set an image named "myimage.jpg" exactly inside that div with "200" pixels in width, and "200" pixels in height.

    Here is the CSS code that might do the trick.

    #BigDiv {
    background:url(myimage.jpg) no-repeat center center; height:200px; width:200px;
    }


    One knowing disadvantage of this problem is its not as SEO/reader friendly ,if you could use image src, you can also call alt attribute to make it SEO/reader friendly.

    Solution 2:


    First we will set our larger div's position as relative.

    #BigDiv{position:relative;}

    Then we assign a class name for our image. ie.

    <img src= "myimage.jpg" class='myimage'/>

    Then rest Css Code

    .myimage{
    position:absolute;
    top:50%;
    left:50%;
    margin-top:-25px;
    margin-left:-25px;
    }


    This works only if we know the dimensions of both the image and the containing div.
    Here,our margins are negative half of the size of the image.


    Solution 3:

    Assume that you know the size of container div and you dont know the dimensions of images.
    If you are working with a light-box,or image carousels,it will be useful.
    Our container div has the id as #BigDiv

    #BigDiv
    {
    display:table-cell;
    vertical-align:middle;
    height:200px;
    width:200px;
    }
    img
    {
     /*Apply any styling here*/
    }



    Solution 4:


    Another nice solution that might work is to create a table with valign.
    This would work even if you know div's height or not.

    <div>
    <table width="100%" height="100%" align="center" valign="center">
    <tr>
    <td>
    <img src="myimage.jpg" alt="myimage" />
    </td>
    </tr>
    </table>
    </div>

    But it will be good if you use css solution wherever possible.



    Read Article →

    Zoom image,text,div,anything on hover With CSS!

    Here is how you can zoom any html element with css only!
    To get a smooth effect, we will add transition effects to all elements in web page.
    
    * {
        /*transition*/
        -webkit-transition: all 0.2s ease;
        -moz-transition: all 0.2s ease;
        -o-transition: all 0.2s ease;
        transition: all 0.2s ease;
    }
    
    


    In first example, we give font size as 50px.
    Then in its hover state, we add it as 100px.
    so when user hover on text, it will get bigger with smooth transition effect.

    In second Example, as you can see we use "transform" to tranform the element to something bigger than the original.
    In Chrome you will use -webkit-transform: scale(1); in idle state and in hover state, you will assign to -webkit-transform: scale(2);, so it will be zoomed when user hover on it.
    In Third Example we use the "width" attribute for element, you can zoom any div, or image with css by doing this way.
    So at first, it was like this.
    width: 50px;
    height: 50px;
    When user hover on this, it will change to
    width: 100px;&nbsp;
    height: 100px;
    In fourth example, we use "zoom" attribute.
    In idle state it will be 100%;
    So we will Change that to
    zoom:150%;
    Thus it will be zoomed when user hover on that.

    ❤
    
    #one 
    { 
    font-size: 50px;
    top: 0;
    left: 0;
    }
    
    #one:hover 
    {
    font-size: 100px 
    }
    
    

    ❤
    
    #two {
        /*transform*/
        -webkit-transform: scale(1);
        -moz-transform: scale(1);
        -ms-transform: scale(1);
        -o-transform: scale(1);
        transform: scale(1);
     
     top: 0;
     left: 100px;
    }
    
    #two:hover {
        /*transform*/
        -webkit-transform: scale(2);
        -moz-transform: scale(2);
        -ms-transform: scale(2);
        -o-transform: scale(2);
        transform: scale(2);
    }
    
    

    ❤
    
    #three {
    width: 50px;
    height: 50px;
    text-align: center;
    left: 200px;
    top: 0;
    }
    
    #three:hover {
    width: 100px;
    height: 100px;
    }
    
    
    

    ❤
    
    #four{
    width: 50px;
    height: 50px;
    margin-top:-20px; 
    margin-left:40px;
    }
    #four:hover{
    zoom:150%;
    }
    
    

    Read Article →

    Change Image background with CSS only!

    In my prevoius article, i have wrote how to set darkening effect for an image with CSS,JavaScript,Or jQuery.
    Here i demonstrate how to set image effects only with CSS.
    To see the effects in action, hover on each images below.you can see colors changing in the image.
    Here Is the CSS
    
    
    <style>
    .wrap {
        overflow: auto;
    }
    .bg {overflow: hidden;float: left;}
    .bg2{background:red;}
    .bg3{background:green;}
    .bg4{background:purple;}
    .bg5{background:yellow;}
    .bg6{background:hotpink;}
    .bg7{background:#ccc;}
    .bg img {
        float: left;
        background: black;
        display: block;
        -moz-transition: opacity .3s linear;
        -webkit-transition: opacity .3s linear;
        -ms-transition: opacity .3s linear;
        -o-transition: opacity .3s linear;
        transition: opacity .3s linear;
      }
      .bg img:hover {
        opacity: .5;
        cursor: pointer;
      }
    </style>
    
    
    In this CSS, We are assigning 7 classes ,each class has its own background color property set. And a wrapper class to wrap the images. And we assign a class named "bg" where we make the float property set to avoid problem with positioning. Now Have a look at Html code
    
    
    <div class="wrap">
    <div class="bg bg2">
    <img alt="" class="t2" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
      </div>
    <div class="bg bg3">
    <img alt="" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
            </div>
    <div class="bg bg4">
    <img alt="" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
                </div>
    <div class="bg bg5">
    <img alt="" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
                    </div>
    <div class="bg bg6">
    <img alt="" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
                        </div>
    <div class="bg bg7">
    <img alt="" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEify_lGIWF48wrBM8WqYvkJ4qJhmR12TWFEkOEE_Rlusa0UdOlyR1jJjKmROn0G4HGjVRXc3FIXw4A7PFgy-52ix-cf8yIWYCFxzFfgjeVfDF8HoTXUfIzyi2Qq2p2qv-1Xmw2bd8Hr8I0z/s1600/darkenimage.jpg" width="200" />
    </div>
    </div>
    
    
    


    Read Article →