"Less series" triangular mixins

Source: Internet
Author: User

. Triangle-el-simple (){content: "";Display:Block;width:0;Height:0;position:Absolute;}. Triangle (@size){Border:(@size/2) Solid transparent;}. Triangle-left (@size: 20px, @color: #000, @offset: 0){&:before{. Triangle-el-simple ();. Triangle (@size); Border-color:transparent @color Transparent transparent;Border-left-width:0; Right:100%;Top:@offset; }}.triangle-inner-left (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:transparent transparent transparent @color;Border-right-width:0; Left:0;Top:@offset; }}.triangle-right (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:transparent transparent transparent @color;Border-right-width:0; Left:100%;Top:@offset; }}.triangle-inner-right (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:transparent @color Transparent transparent;Border-left-width:0; Right:0;Top:@offset; }}.triangle-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:transparent transparent @color transparent;Border-top-width:0;Bottom:100%; Left:@offset; }}.triangle-inner-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:@color Transparent Transparent transparent;Border-bottom-width:0;Top:0; Left:@offset; }}.triangle-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:@color Transparent Transparent transparent;Border-bottom-width:0;Top:100%; Left:@offset; }}.triangle-inner-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size); Border-color:transparent transparent @color transparent;Border-top-width:0;Bottom:0; Left:@offset; }}.triangle-left-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-top:@size Solid @color;Top:100%;Border-left:0 Solid Transparent; Left:@offset; }}.triangle-inner-left-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-top:@size Solid @color;Border-left:0 Solid Transparent;Top:0; Left:@offset;Margin-left:@size * ( -1); }}.triangle-right-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-top:@size Solid @color;Top:100%;Border-right:0 Solid Transparent; Left:@offset; }}.triangle-inner-right-top (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-top:@size Solid @color;Top:0;Border-right:0 Solid Transparent; Left:@offset; }}.triangle-left-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-bottom:@size Solid @color;Bottom:100%;Border-left:0 Solid Transparent; Left:@offset; }}.triangle-inner-left-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-bottom:@size Solid @color;Bottom:0;Border-left:0 Solid Transparent; Left:@offset; }}.triangle-right-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-bottom:@size Solid @color;Bottom:100%;Border-right:0 Solid Transparent; Left:@offset; }}.triangle-inner-right-bottom (@size: 20px, @color: #000, @offset: 0){&:before {. Triangle-el-simple ();. Triangle (@size * 2); Border-bottom:@size Solid @color;Bottom:0;Border-right:0 Solid Transparent; Left:@offset; }}/*Triangle Series Mixinsmixins the left in the name, right, top, bottom describes the direction parameter description of the angle of 90 degrees in the triangle: @size--the size of the triangle @color--the color of the triangle @offset-- The position of the triangle (if the mixins name is end with top or bottom, then this parameter adjusts the horizontal position. If the mixins name ends with left or right, then this parameter adjusts the vertical position)*/Body{background:#fff;}. Wrap{Display:Inline-block;background:#ff0;margin:20px;padding:10px;width:240px;Height:45px;Line-height:45px;Color:#fff;text-align:Center;position:relative;}. up{. Triangle-bottom (10px, #f36);}
<!DOCTYPE HTML><HTML><HeadLang= "en">    <MetaCharSet= "UTF-8">    <title></title>    <Linktype= "Text/css"rel= "stylesheet"href= "Test.css"></Head><Body><Divclass= "Wrap Up">Hello sass! Up</Div></Body></HTML>

"Less series" triangular mixins

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.