How To Create The + Button With Css?
When you input 'google' into Google, you will see there is a + button Show stock quote for GOOG With firebug, you can see
, what is the content of the
Solution 1:
The button is actually just an image. Google loads an image which contains a bunch of the links and images for their site and just adjusts the display of the background to show the piece they want to show.
These are the main styles needed to achieve what they're doing.
background:transparent url(/images/nav_logo7.png) no-repeat scroll 00;
height:13px;
overflow:hidden;
width:13px;
background-position:-91px -74px;
You can find all of this by examining the CSS when you're using FireBug.
Solution 2:
Here's an example with a +/- button, no images. All text and CSS.
<html><head><scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script><!DOCTYPE htmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"><head><title>Test Expander</title><metahttp-equiv="Content-type"content="text/html; charset=utf-8" /><styletype="text/css"media="screen">body { background-color: #FFF; font: 16px Helvetica, Arial; color: #000; }
.hidden { display:none;}
.indented {margin-left: 32px;}
a.expander:active,
a.expander:visited,
a.expander:link {
color: #0000CD; /* ca2f2b; */text-decoration : none;
/* display : block; */border-bottom: 1px dotted #000;
border-left: 1px dotted #000;
border-right: 1px dotted #000;
border-top: 1px dotted #000;
padding: 1px;
}
a.expander:hover {
color: #FF00FF; /* FF00FF == Fuschia #000; */text-decoration : none;
background: #E6E6FA; /* shading *//* #f4f4f4; */padding: 1px;
/* draw a shaded box around the thing when hovering */border-bottom: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-top: 1px solid #ccc;
}
</style></head><body><h1>Hello</h1><divid="div0"><pid="intro"><ahref="#"class='expander'>+</a>
Introduction</p><pclass='hidden indented' >
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer
vulputate, nibh non rhoncus euismod, erat odio pellentesque lacus,
sit amet convallis mi augue et odio. Phasellus cursus urna facilisis quam.
</p><pclass='hidden indented' > Quisque pharetra lacus quis sapien. Duis
id est non wisi sagittis adipiscing. Nulla facilisi. Etiam quam erat,
lobortis eu, facilisis nec, blandit hendrerit, metus. Fusce
hendrerit. Nunc magna libero, sollicitudin non, vulputate non, ornare
id, nulla. Suspendisse potenti. Nullam in mauris.
</p></div><divid="div1"><pid="sec1"><ahref="#"class='expander'>+</a>
Section 1</p><pclass='hidden indented' >
Vivamus congue pede at quam. Aliquam aliquam leo vel turpis. Ut
commodo. Integer tincidunt sem a risus. Cras aliquam libero quis
arcu. Integer posuere. Nulla malesuada, wisi ac elementum sollicitudin,
libero libero molestie velit, eu faucibus est ante eu libero. Sed
vestibulum, dolor ac ultricies consectetuer, tellus risus interdum diam,
a imperdiet nibh eros eget mauris. Donec faucibus volutpat
augue. Phasellus vitae arcu quis ipsum ultrices fermentum. Vivamus
ultricies porta ligula. Nullam malesuada. Ut feugiat urna non
turpis. Vivamus ipsum. Vivamus eleifend condimentum risus. Curabitur
pede. Maecenas suscipit pretium tortor. Integer pellentesque.
</p></div><divid="div2"><pid="sec2"><ahref="#"class='expander'>+</a>
Section 2</p><pclass='hidden indented' >
Mauris est. Aenean accumsan purus vitae ligula. Lorem ipsum dolor sit
amet, consectetuer adipiscing elit. Nullam at mauris id turpis placerat
accumsan. Sed pharetra metus ut ante. Aenean vel urna sit amet ante
pretium dapibus. Sed nulla. Sed nonummy, lacus a suscipit semper, erat
wisi convallis mi, et accumsan magna elit laoreet sem. Nam leo est,
cursus ut, molestie ac, laoreet id, mauris. Suspendisse auctor nibh.
</p><pclass='hidden indented' >
Nulla erat lorem, fringilla eget, ultrices nec, dictum sed,
sapien. Aliquam libero ligula, porttitor scelerisque, lobortis nec,
dignissim eu, elit. Etiam feugiat, dui vitae laoreet faucibus, tellus
urna molestie purus, sit amet pretium lorem pede in erat. Ut non libero
et sapien porttitor eleifend.
</p></div></body></html>
Solution 3:
it's this image:
http://www.google.cz/images/nav_logo7.png
for inspecting those things, use firebug:
Post a Comment for "How To Create The + Button With Css?"