CSS 3 implements irregular tab Label Switching code for animation, and css3tab label

Source: Internet
Author: User

CSS 3 implements irregular tab Label Switching code for animation, and css3tab label
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> tab implemented by pure CSS3 </title>
<Style>
Body {
Width: 700px;
Margin: 100px auto 0 auto;
Font-family: Arial, Helvetica;
Font-size: small;
Background: #444;
}
# Tabs {
Overflow: hidden;
Width: 100%;
Margin: 0;
Padding: 0;
List-style: none;
}
# Tabs li {
Float: left;
Margin: 0. 5em 0 0;
}
# Tabs {
Position: relative;
Background: # ddd;
Background-image:-webkit-gradient (linear, left top, left bottom, from (# fff), to (# ddd ));
Background-image:-webkit-linear-gradient (top, # fff, # ddd );
Background-image:-moz-linear-gradient (top, # fff, # ddd );
Background-image:-ms-linear-gradient (top, # fff, # ddd );
Background-image:-o-linear-gradient (top, # fff, # ddd );
Background-image: linear-gradient (to bottom, # fff, # ddd );
Padding:. 7em 3.5em;
Float: left;
Text-decoration: none;
Color: #444;
Text-shadow: 0 1px 0 rgba (255,255,255,. 8 );
-Webkit-border-radius: 5px 0 0 0;
-Moz-border-radius: 5px 0 0 0;
Border-radius: 5px 0 0 0;
-Moz-box-shadow: 0 2px 2px rgba (0, 0, 0,. 4 );
-Webkit-box-shadow: 0 2px 2px rgba (0, 0, 0,. 4 );
Box-shadow: 0 2px 2px rgba (0, 0, 0,. 4 );
}
# Tabs a: hover, # tabs a: hover: after, # tabs a: focus, # tabs a: focus: after {
Background: # fff;
}
# Tabs a: focus {
Outline: 0;
}
# Tabs a: after {
Content :'';
Position: absolute;
Z-index: 1;
Top: 0;
Right:-. 5em;
Bottom: 0;
Width: 1em;
Background: # ddd;
Background-image:-webkit-gradient (linear, left top, left bottom, from (# fff), to (# ddd ));
Background-image:-webkit-linear-gradient (top, # fff, # ddd );
Background-image:-moz-linear-gradient (top, # fff, # ddd );
Background-image:-ms-linear-gradient (top, # fff, # ddd );
Background-image:-o-linear-gradient (top, # fff, # ddd );
Background-image: linear-gradient (to bottom, # fff, # ddd );
-Moz-box-shadow: 2px 2px 2px rgba (0, 0, 0,. 4 );
-Webkit-box-shadow: 2px 2px 2px rgba (0, 0, 0,. 4 );
Box-shadow: 2px 2px 2px rgba (0, 0, 0,. 4 );
-Webkit-transform: skew (10deg );
-Moz-transform: skew (10deg );
-Ms-transform: skew (10deg );
-O-transform: skew (10deg );
Transform: skew (10deg );
-Webkit-border-radius: 0 5px 0 0;
-Moz-border-radius: 0 5px 0 0;
Border-radius: 0 5px 0 0;
}
# Tabs # current a, # tabs # current a: after {
Background: # fff;
Z-index: 3;
}
# Content {
Background: # fff;
Padding: 2em;
Height: 220px;
Position: relative;
Z-index: 2;
-Moz-border-radius: 0 5px 5px 5px;
-Webkit-border-radius: 0 5px 5px 5px;
Border-radius: 0 5px 5px 5px;
-Moz-box-shadow: 0-2px 3px-2px rgba (0, 0, 0,. 5 );
-Webkit-box-shadow: 0-2px 3px-2px rgba (0, 0, 0,. 5 );
Box-shadow: 0-2px 3px-2px rgba (0, 0, 0,. 5 );
}
# Content h2, # content h3, # content p {
Margin: 0 0 15px 0;
}
# About {
Color: #999;
}
# About {
Color: # eee;
}
</Style>
</Head>


<Body>
<Div> <A href = "http://www.999jiujiu.com/"> http://www.999jiujiu.com/</A> </div>
<Ul id = "tabs">
<Li> <a href = "/" title = "tab1"> Tab 1 </a> </li>
<Li> <a href = "#" title = "tab2"> Tab 2 </a> </li>
<Li> <a href = "#" title = "tab3"> tab 3 </a> </li>
<Li> <a href = "#" title = "tab4"> tab 4 </a> </li>
</Ul>
<Div id = "content">
<Div id = "tab1">
<H2> Lorem ipsum sit amet <P> Praesent risus nisi, iaculis nec condimentum vel, rhoncus vel dolor. Aenean nisi lectus, varius nec tempus id, dapibus non quam. </p>
<P> Suspendisse ac libero mauris. Cras lacinia porttitor urna, vitae extends libero posuere et. Mauris turpis tortor, mollis non vulputate sit amet, rhoncus vitae purus.
<H3> Pellentesque habitant <P> Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae. </p>
</Div>
<Div id = "tab2">
<H2> Vivamus fringilla suscipit justo <P> Aenean dui nulla, egestas sit amet auctor vitae, facilisis id odio. Donec dictum gravida feugiat. </p>
<P> Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras presponelit et erat condimentum et volutpat lorem vehicula </p>
<P> Morbi tincidunt pharetra orci commodo molestie. Praesent ut leo nec dolor tempor eleifend. </p>
</Div>
<Div id = "tab3">
<H2> Phasellus non nibh <P> Non erat laoreet ullamcorper. Adjust magna metus, feugiat eu elementum sit amet, cursus sed diam. Curabitur posuere porttitor lorem, eu malesuada tortor faucibus sed. </p>
<H3> Duis pulvinar nibh vel urna <P> Donec purus leo, porttitor eu molestie quis, porttitor sit amet ipsum. class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. donec accumsan ornare elit id imperdiet. </p>
<P> sustmdisse ac libero mauris. Cras lacinia porttitor urna, vitae molestie libero posuere et. </p>
</Div>
<Div id = "tab4">
<H2> Cum sociis natoque penatibus <P> Magnis dis parturient montes, nascetur ridiculus mus. Nullam ac massa quis nisi porta mollis venenatis sit amet urna. Ut in mauris velit, bibsed endum turpis. </p>
<P> Nam ornare vulputate risus, id volutpat elit porttitor non. in consequat nisi vel lectus dapibus sodales. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. praesent bibendum sagittis libero. </p>
<H3> Imperdiet sem interdum nec <P> Mauris rhoncus tincidunt libero quis fringilla. </p>
</Div>
</Div>
<Br>
<Br>
<Script src = "/ajaxjs/jquery-1.6.2.min.js"> </script>
<Script>
$ (Document). ready (function (){
$ ("# Content div"). hide ();
$ ("# Tabs li: first"). attr ("id", "current ");
$ ("# Content div: first"). fadeIn ();

$ ('# Tabs A'). click (function (e ){
E. preventDefault ();
$ ("# Content div"). hide ();
$ ("# Tabs li"). attr ("id ","");
$ (This). parent (). attr ("id", "current ");
$ ('#' + $ (This). attr ('title'). fadeIn ();
});
})();
</Script>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.