Hi, guys, still in the top and bottom of the tip of the anxious, still use the use of pictures, symbols, multi-layered relationships or border 2 triangles overlap to achieve? Since it's not perfect, let's take a look at how the CSS3 Transfrom is right for you.
Overview:
The CSS visual formatting model describes the coordinate system of each element's position on a coordinate systems. Positioning and size in this coordinate space can be thought of as pixels, starting at the origin point with the right and down actual values. The Transform property can modify this coordinate space. With transformations, elements can be transformed, rotated, and extended in two or three-dimensional spaces.
The point is that we're going to use Transfroms's transform rendering model:
Creates a new local coordinate system element for the property of ' transform ' to apply it to a value other than the specified ' none '. The local coordinate system renders the mapping of the elements through the transformation matrix of the elements. The conversion is cumulative. In other words, the elements establish their local coordinate system in their parent coordinate system. From the user's point of view, an element effectively accumulates all of the transform attributes to suit its ancestors and any local changes. The accumulation of these transform defines a universal transformation matrix (CTM) for elements.
EXAMPLE
div {
Transform:translate (100px,100px);
}
The element that this transformation 100 pixels moves in the X and y directions.
EXAMPLE
div {
height:100px;width:100px;
Transform:translate (80px,80px) scale (1.5,1.5) rotate (45deg);
}
<div style= "Transform:translate (80px, 80px)" >
<div style= "Transform:scale (1.5, 1.5)" >
<div style= "Transform:rotate (45deg)" ></div>
</div>
</div>
This transformation moves the 80-pixel element in the X and y directions, then by the 150%-scale element, then its z-axis rotates 45 ° clockwise. Attention needs to be given to the size and rotation of the element in the center, because the element has "50% 50% of the transformation source by default." It is important to note that the same rendering can be obtained by equivalent transformations of nested elements.
The OK book belongs to the story, and tip comes in a total of two steps:
1. We want to create a square shape with border, with CSS3 Transfrom for 45 degrees of rotation.
2.IE implementation-the CSS3 Transfrom compatibility scheme is implemented using the IE matrix filter.
EXAMPLE
. Tips {
width:200px;
position:relative;
padding:10px;
Border:1pxsolid Blue;
Background-color:skyblue;
border-radius:5px;
}
. diamond{
-ms-filter: "Progid:DXImageTransform.Microsoft.Matrix (m11=0.7071067811865475, m12=-0.7071067811865477, m21= 0.7071067811865477, m22=0.7071067811865475, sizingmethod= ' auto expand ') ";
Filter:progid:DXImageTransform.Microsoft.Matrix (
m11=0.7071067811865475,
m12=-0.7071067811865477,
m21=0.7071067811865477,
m22=0.7071067811865475,
sizingmethod= ' Auto expand '
);
-moz-transform:rotate (45DEG);
-o-transform:rotate (45DEG);
-webkit-transform:rotate (45DEG);
-ms-transform:rotate (45DEG);
Transform:rotate (45DEG);
Position:absolute;
width:10px;
height:10px;
Background-color:skyblue;
Display:block;
font-size:0;
}
: Root. diamond{filter:none\9;} /*IE9 hack*/
. tip-top{
Border-top:1pxsolid Blue;
Border-left:1pxsolid Blue;
left:10px;
top:-6px;
}
. tip-left{
Border-bottom:1pxsolid Blue;
Border-left:1pxsolid Blue;
left:-6px;
top:20px;
}
. tip-bottom{
Border-bottom:1pxsolid Blue;
Border-right:1pxsolid Blue;
left:10px;
bottom:-6px;
}
. tip-right{
Border-top:1pxsolid Blue;
Border-right:1pxsolid Blue;
right:-6px;
top:20px;
}
<div class= "Tips" >
<i class= "Diamond tip-top" ></i>
<i class= "Diamond Tip-bottom" ></i>
<i class= "Diamond Tip-left" ></i>
<i class= "Diamond Tip-right" ></i>
<div class= "Text" ></div>
</div>
Reference reading: http://www.w3.org/TR/2012/WD-css3-transforms-20120403
CSS3 Backwards-compatible tip