CSS3 Backwards-compatible tip

Source: Internet
Author: User

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

    1. div {

    2. Transform:translate (100px,100px);

    3. }

The element that this transformation 100 pixels moves in the X and y directions.

EXAMPLE

    1. div {

    2. height:100px;width:100px;

    3. Transform:translate (80px,80px) scale (1.5,1.5) rotate (45deg);

    4. }

    5. <div style= "Transform:translate (80px, 80px)" >

    6. <div style= "Transform:scale (1.5, 1.5)" >

    7. <div style= "Transform:rotate (45deg)" ></div>

    8. </div>

    9. </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

  1. . Tips {

  2. width:200px;

  3. position:relative;

  4. padding:10px;

  5. Border:1pxsolid Blue;

  6. Background-color:skyblue;

  7. border-radius:5px;

  8. }

  9. . diamond{

  10. -ms-filter: "Progid:DXImageTransform.Microsoft.Matrix (m11=0.7071067811865475, m12=-0.7071067811865477, m21= 0.7071067811865477, m22=0.7071067811865475, sizingmethod= ' auto expand ') ";

  11. Filter:progid:DXImageTransform.Microsoft.Matrix (

  12. m11=0.7071067811865475,

  13. m12=-0.7071067811865477,

  14. m21=0.7071067811865477,

  15. m22=0.7071067811865475,

  16. sizingmethod= ' Auto expand '

  17. );

  18. -moz-transform:rotate (45DEG);

  19. -o-transform:rotate (45DEG);

  20. -webkit-transform:rotate (45DEG);

  21. -ms-transform:rotate (45DEG);

  22. Transform:rotate (45DEG);

  23. Position:absolute;

  24. width:10px;

  25. height:10px;

  26. Background-color:skyblue;

  27. Display:block;

  28. font-size:0;

  29. }

  30. : Root. diamond{filter:none\9;} /*IE9 hack*/

  31. . tip-top{

  32. Border-top:1pxsolid Blue;

  33. Border-left:1pxsolid Blue;

  34. left:10px;

  35. top:-6px;

  36. }

  37. . tip-left{

  38. Border-bottom:1pxsolid Blue;

  39. Border-left:1pxsolid Blue;

  40. left:-6px;

  41. top:20px;

  42. }

  43. . tip-bottom{

  44. Border-bottom:1pxsolid Blue;

  45. Border-right:1pxsolid Blue;

  46. left:10px;

  47. bottom:-6px;

  48. }

  49. . tip-right{

  50. Border-top:1pxsolid Blue;

  51. Border-right:1pxsolid Blue;

  52. right:-6px;

  53. top:20px;

  54. }

  55. <div class= "Tips" >

  56. <i class= "Diamond tip-top" ></i>

  57. <i class= "Diamond Tip-bottom" ></i>

  58. <i class= "Diamond Tip-left" ></i>

  59. <i class= "Diamond Tip-right" ></i>

  60. <div class= "Text" ></div>

  61. </div>

Reference reading: http://www.w3.org/TR/2012/WD-css3-transforms-20120403

CSS3 Backwards-compatible tip

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.