Tuesday, September 30, 2014

CSS Folding Paper Like Menu.

<style type="text/css">

ul,li{
margin: 0;
padding: 0;
}

.main{
position:absolute;
z-index:1;
}

.main li{
list-style:none;
background: #9b59b6;
width:100px;
padding: 0 5px;
border: 1px solid black;
height: 30px;
line-height: 30px;
-webkit-transition: all .5s ease-in-out;
}

.main li:nth-child(odd){
-webkit-transform-origin: top;
-webkit-transform: perspective(350px) rotateX(-90deg);
}

.main li:nth-child(even){
margin-top:-65px;
-webkit-transform-origin: bottom;
-webkit-transform: perspective(350px) rotateX(90deg);
}

.hov:hover li:nth-child(odd){
-webkit-transform-origin: top;
-webkit-transform: perspective(30px) rotateX(0deg);
margin-top:0;
}

.hov:hover li:nth-child(even){
-webkit-transform-origin: bottom;
-webkit-transform: perspective(30px) rotateX(0deg);
margin-top:0;
}

.main li:first-child{
margin-top:0;
}

.hov{
position:relative;
height: 40px;
width:112px;
background: #2ecc71;
color: white;
font-size: 13px;
font-family: Helvetica;
font-weight:bold;
text-align: center;
line-height: 40px;
list-style:none;
z-index:2;
}

</style>

<nav>
<li class="hov">Hover Me!
<ul class="main">
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
</li>
</nav>


Output :)

1)

2)

Monday, September 29, 2014

CSS3 fold and unfold effect.

<style type="text/css">

body {
  padding: 50px;
  font-family: Arial, sans-serif;
}

#folder {
  width: 300px;
  padding: 10px;
}

.fold {
  background: -webkit-linear-gradient(top, #e5e5e5, #ccc);
  background: -moz-linera-gradient(top, #e5e5e5, #ccc);
  padding: 10px;
  width: 280px;
  height: 80px;
  color: #999;
  -webkit-transition: all 0.3s linear;
  -moz-transition: all 0.3s linear;
  transition: all 0.3s linear;
}

#toggle { display: none; }

#toggle-label {
  display: inline-block;
  cursor: pointer;
  margin-bottom: 50px;
  border: 1px solid #e5e5e5;
  font-size: 11px;
  color: #999;
  background: #fff;
  text-transform: uppercase;
  border-radius: 5px;
  padding: 5px;
}

#toggle:checked ~ .fold:nth-child(odd) {
  margin-top: -82px;
    -webkit-transform: perspective(800px) rotateX(-80deg);
  -moz-transform: perspective(800px) rotateX(-80deg);
  transform: perspective(800px) rotateX(-80deg);
}

#toggle:checked ~ .fold:nth-child(even) {
  margin-top: -84px;
    -webkit-transform: perspective(800px) rotateX(80deg);
  -moz-transform: perspective(800px) rotateX(80deg);
  transform: perspective(800px) rotateX(80deg);
}

</style>

<div id="folder">

  <input type="checkbox" id="toggle"/> <label for="toggle" id="toggle-label">fold/unfold</label>
   
  <div class="fold">
    Element 1
   </div>
   <div class="fold">
    Element 2
   </div>
   <div class="fold">
    Element 3
   </div>
   <div class="fold">
    Element 4
   </div>
   <div class="fold">
    Element 5
   </div>

</div>


Output :)

1)

2)

Saturday, September 27, 2014

CSS Hover attribute reveal non-div element.

<style type="text/css">

span {
   display: none;
   font-size: 25px;
   color: #321321;
}
.something1:hover ~ [class*="text"] {
   display: block;
}

</style>

<div class="container">

<h2 class="something1">Hover on Me</h4>

<span class="text1">MaHi</span>
<span class="text2">MaHii</span>
<span class="text3">MaHiii</span>
<span class="text4">MaHiiii</span>

</div>

Output :)

1)

2)

Friday, September 26, 2014

Place a checkbox within a button.

First you need some basic knowledge about jQuery. Please visit http://jquery.com/ for some guidance.

Example :)

<html>
<head>
<title>MaHi CSS Tution</title>

<style type="text/css">
#container{
padding:50px;
}
#btnOuterDIV{
height:30px;
width:80px;
border:1px solid #ccc;
border-radius:5px;
}
#btnOuterDIV:hover{
border-color:#888;
overflow:hidden;
cursor:pointer;
}
#btnChkbox{
height:15px;
width:15px;
float:left;
padding-top:5px;
padding-left:5px;
}
#btnLabel{
height:70%;
width:60%;
font-size:10px;
float:left;
padding-top:10px;
padding-left:5px;
}
#btnLabel:hover{
color:blue;
}
</style>

<script type="text/javascript" src="jquery-1.11.1.min.js"></script>

</head>

<body>
<div id="container">
   <div id="btnOuterDIV">
       <div id="btnChkbox">
           <input type="checkbox" id="btnCB" />
       </div>
       <div id="btnLabel">
           Click Me
       </div>
   </div>
</div>

<script type="text/javascript">
$(function(){
$('#btnOuterDIV').click(function(){
   alert('You clicked the button');
   $('#btnCB').prop('checked',true);
});
});
</script>

</body>
</html>

Output :)

1)

2)

Thursday, September 25, 2014

Making text appear when hovering over an image.

<style type="text/css">

.wow {
   position:relative;
   width:250px;
   height:250px;
   -webkit-transition: opacity 0.8s ease-in-out;
   -moz-transition: opacity 0.8s ease-in-out;
   -o-transition: opacity 0.8s ease-in-out;
   -ms-transition: opacity 0.8s ease-in-out;
   transition: opacity 0.8s ease-in-out;
}
.wow img {
   position:relative;
   z-index:1
}
.overlay {
   position:absolute;
   width:100%;
   height:100%;
   top:0;
   left:0;
   z-index:2;
   opacity:0;
   -webkit-transition: opacity 0.4s ease-in-out;
   -moz-transition: opacity 0.4s ease-in-out;
   -o-transition: opacity 0.4s ease-in-out;
   -ms-transition: opacity 0.4s ease-in-out;
   transition: opacity 0.4s ease-in-out;
}
.wow:hover > .overlay {
   opacity:1;
   width:560px;
   height:310px height:auto;
   padding:5px;
   display:block;
   background:rgba(255, 255, 255, 0.4)
}
#wow img:hover {
   opacity: 0.4;
}

</style>

<div class="wow">
    <img src="m3.png" alt="" />
    <div class="overlay">This is some text</div>
</div>

Output :)

1)

2)

Wednesday, September 24, 2014

CSS Show rounded labels.

Note : This is not image. it is Text. I want to show rounded label on the top right corner of Image.

Example :)

<style type="text/css">
 .box {
     position: relative;
     display: inline-block;
     top: 20px;
     margin-right: 20px;
 }

  .index {
     background: none repeat scroll 0 0 #0063ff;
     border: 2px solid #ffffff;
     border-radius: 25px;
     color: #fff;
     font-size: 28px;
     font-weight: bold;
     padding: 5px 15px;
     position: absolute;
     right: -10px;
     top: -10px;
 }
</style>

<div class="box">
    <img src="1.png" alt="image" />
    <span class="index">1</span>
</div>

<div class="box">
    <img src="1.png" alt="image" />
    <span class="index">2</span>
</div>

<div class="box">
    <img src="1.png" alt="image" />
    <span class="index">3</span>
</div>

Output :)



Tuesday, September 23, 2014

How to equally distribute floated divs?

<title>Mahi CSS Tution</title>

<style type="text/css">
    .container{
        font-size:0;
        text-align:justify
    }

    .container::after{
        width: 100%;
        display: inline-block;
        content: "";
        visibility: hidden;
    }

    .box{
        margin:20px;
        width:50px;
        height:50px;
        background:green;
        display:inline-block
    }

    /*Div 2 - the box-container is so you can see the effect*/
 
    .container1{
        display:table;
        text-align:middle;
        width:100%
    }

    .box-container{
        display:table-cell;
        width:25%;
    }

    .box1{
        width:50px;
        height:50px;
        background:blue;
        margin:0 auto
    }
</style>

<!-- Div 1 -->
<div class="container">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
</div>

<hr/>

<!-- Div 2-->

<div class="container1">

    <div class="box-container">
         <div class="box1"></div>
    </div>

    <div class="box-container">
         <div class="box1"></div>
    </div>

    <div class="box-container">
         <div class="box1"></div>
    </div>

    <div class="box-container">
         <div class="box1"></div>
    </div>

</div>


Output :)