My studying notebook

2010/07/07

Google Reader's Toggle Icon

7/07/2010 03:13:00 PM Posted by Unknown , 7 comments

If you have used Google Reader. There is a toggle icon you can click and expand all items view size. This toggle icon is a small blue arrow. Is it a image? No. It's just a CSS tips and tricks. How does CSS do it?
Toggle icon DOM element
...
<td id="chrome-lhn-toggle">
    <div id="chrome-lhn-toggle-icon"></div>
</td>
...

Toggle icon CSS
{
    width: 0;
    height: 0;
    border-color: #ebeff9 #68e #ebeff9 #ebeff9;
    border-style: solid;
    border-width: 5px 5px 5px 0;
}

You just need to assign the "border" CSS to toggle icon DOM element like ahove.
You may have to assign others CSS if you want this toggle icon in that correct position you want.



border Css order style
#right{
border-style:solid;
border-color: red green blue yellow;
border-style: solid;
border-width: 50px 50px 50px 50px;
width:0;
height:0;
display:inline-block;
}
#left{
border-style:solid;
border-color: #ebeff9 #68e #ebeff9 #ebeff9;
border-style: solid;
border-width: 50px 50px 50px 50px;
width:0;
height:0;
display:inline-block;
}

Whole DOM and CSS code
//DOM
...
<td id="chrome-lhn-toggle">
    <div id="chrome-lhn-toggle-icon"></div>
</td>
...
//CSS
#chrome-lhn-toggle:hover {
background: #C2CFF1;
}
#chrome-lhn-toggle, #chrome-viewer {
padding: 0px;
vertical-align: top;
}
#chrome-lhn-toggle {
background: #EBEFF9;
cursor: pointer;
width: 8px;
}
#chrome-lhn-toggle:hover #chrome-lhn-toggle-icon {
border-color: #C2CFF1 white #C2CFF1 #C2CFF1;
}
#chrome-lhn-toggle-icon {
border-color: #EBEFF9 #68E #EBEFF9 #EBEFF9;
border-style: solid;
border-width: 5px 5px 5px 0px;
height: 0px;
margin-left: 1px;
margin-top: -5px;
position: absolute;
top: 50%;
width: 0px;
}
#chrome-lhn-toggle-icon {
font-size: 1px;
line-height: 1px;
}

Conclusion
This is a simple way to make a arrow icon by pure CSS instead of assigning image.

7 comments:

  1. Gaining Python certifications will validate your skills and advance your career.
    python certification

    ReplyDelete
  2. a really good post man thanks for sharing
    hotmail sign up

    ReplyDelete
  3. All of pitbull dog and puppy are sent home. Current on shots, deworming, flea treated, health certificate, genetic health guarantee, and AKC registration papers. All new families are required to sign a contract that includes a basic health guarantee and a 3 year genetic health guarantee.
    Pitbull Puppies For Sale
    american pitbull terrier puppies
    pitbull puppies for sale near me
    pitbull breeders for sale
    pit bull breeders near me
    pit bull puppy
    baby pitbulls for sale

    ReplyDelete