The way the small triangle of CSS is implemented

Source: Internet
Author: User

1. width:0 height:0 border width, color and transparent implementation. There are examples.

Http://www.igooda.cn/jzjl/20140401472.html

2. There is also a use of images. (Efficiency not pure CSS write high, but simple, recommended)

3. Use a small text icon. There is also a classic example of a absolute set of absolute.

4. Using padding and the like. Can do a trapezoid look.

=========================================

<style type= "Text/css" >
div{width:0px;/* width */height:0px;/* Height */border:60px solid transparent;/* Border *//*background: #00cccc; background color */}
. Mysan{border-left-color: #00cccc;/* Border Left color */
Border-top-color: #ff0000; *//Border color */
Border-bottom-color: #990000; */* Border under color */
Border-right-color: #ccff00;/* Border Right color */}
. Mysan1{border-left-color: #00cccc;/* Border Left color */}
. Mysan2{border-top-color: #ff0000; *//Border color */}
. Mysan3{border-bottom-color: #990000;/* Border under color */}
. Mysan4{border-right-color: #ccff00;/* Border Right color */}
</style>
<!--body--
<body>
<!--div box model container can set height width can be placed content layer Properties = "Property values"-
<div class= "Mysan" ></div>
<div class= "Mysan1" ></div>
<div class= "Mysan2" ></div>
<div class= "Mysan3" ></div>
<div class= "Mysan4" ></div>
</body>

==================================================

<style type= "Text/css" >
*{padding:0px; margin:0px;}
Img{display:block;}
/*css expression: attribute: value; Width: 300m; px pixels */
#Nav {width:35px;/* Width */height:100%;/* high */background: #000;/* Background color */
position:fixed;/* fixed positioning */right:100px; top:0px;}
#Nav. top{width:35px; height:150px; background: #d8002d; padding-top:70px;position:relative;/* relative positioning */}
#Nav. middle{width:35px; height:310px;}
#Nav. bottom{width:35px; height:110px; position:absolute;/* absolute positioning */right:0px; bottom:0px;}
#Nav. Top img.email{position:absolute;right:0px; bottom:0px;}
#Nav ul li{list-style-type:none;/* Remove dots */font-family: "Microsoft Ya Black";
width:35px; font-size:12px; Color: #fff;
Text-align:center; Position:relative;}
#Nav ul Li span{width:90px; height:35px; background: #aaaaaa; display:block;
line-height:35px; Position:absolute; top:0px;
left:-120px; opacity:0;/*left:-90px; opacity:1;*/}
#Nav ul Li span font{color: #aaaaaa; font-size:16px; font-family: "Song Body";
Position:absolute; right:-8px;top:1px;}
#Nav ul li.go{border-top:1px solid #aaa,/* Weight style color */
border-bottom:1px solid #aaa; padding-bottom:5px;}
#Nav ul li.hover{background: #ff0066;}

</style>

<body>
<!--div box model, height, width, rectangular container with content name = "Pure Heart"--
<div id= "Nav" >

<!--start-up
<div class= "Top" >


</div>
< end!--

<!--Center Start-
<div class= "Middle" >
<ul>
<li>
<span> my privileges <font> </font></span>
</li>


<li class= "Go" > buy <br/> <br/> cars </li>

<li>
<span> My assets <font> </font></span>
</li>
<li>
<span> my focus on the brand <font> </font></span>
</li>
<li>
<span> My collection <font> </font></span>
</li>
<li>
<span> I've seen the <font> </font></span>
</li>
</ul>
</div>
<!--Center End--

<!--below to start-->
<div class= "Bottom";
<ul>
<li>
<span> My concern brand <font> </font></span>
</li>
<li>
<span> my collection <font> </font></span>
</li>
<li>
<span> <font> </font></span> I've seen;
</li>
</ul
</div>
<!--end-->
</div>

<!--referencing an external Jqeury class library--
<script type= "Text/javascript" src= "Js/jquery.js" ></script>
<script type= "Text/javascript" >
$ ("#Nav ul li"). Hover (function () {
if ($ (this). Hasclass ("Go")) {
$ (this). FIND ("img"). attr ("src", "images/go2.png");
}
$ (this). addclass ("hover"); class= "Hover"
$ (this). FIND ("span"). the Stop (). Animate ({left: " -90px", opacity:1},500);
},function () {
if ($ (this). Hasclass ("Go")) {
$ (this). FIND ("img"). attr ("src", "images/go.png");
}
$ (this). Removeclass ("hover"); Remove class= ' hover '
$ (this). FIND ("span"). the Stop (). Animate ({left: " -120px", opacity:0},500);
});
</script>

The way the small triangle of CSS is implemented

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.