Html5 rounded corners

Source: Internet
Author: User
Tags linecap
  1. <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <HtmlXmlns = "http://www.w3.org/1999/xhtml">
  3. <Head>
  4. <MetaHttp-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
  5. <MetaHttp-equiv = "Content-Language" content = "zh-cn"/>
  6. <Title>Draw a rounded corner</Title>
  7. <ScriptType = "text/javascript" src = "jquery-1.4.min.js"> </Script>
  8. <ScriptType = "text/javascript"><! --
  9. $ (Function (){
  10. Var elem = $ ("# myCanvas") [0];
  11. If (! Elem |! Elem. getContext ){
  12. Return;
  13. }
  14. // CanvasRenderingContext2D
  15. Var ctx = elem. getContext ('2d ');
  16. Ctx. fillStyle = '# 00f ';
  17. CTX. strokestyle = '#0f0 ';
  18. CTX. linewidth = 10;
  19. CTX. globalalpha = 1;
  20. // Linecap specifies how to draw the end of a line. The value of round specifies that the line segment should carry a semi-circular line cap, and the diameter of the half circle is equal to the width of the line segment, in addition, the line segment expands half of the width of the line segment beyond the endpoint.
  21. CTX. linecap = "round ";
  22. // The linejoin attribute describes how to draw the intersection point. The value "round" indicates that the outer edge of the specified point should join a filled arc, and the diameter of this arc is equal to the width of the line segment. "
  23. CTX. linejoin = "round ";
  24. Ctx. beginPath ();
  25. Ctx. moveTo (10, 10 );
  26. Ctx. lineTo (200, 10 );
  27. Ctx. lineTo (200,200 );
  28. Ctx. lineTo (10,200 );
  29. Ctx. lineTo (10, 10 );
  30. // Ctx. fill ();
  31. Ctx. stroke ();
  32. Ctx. closePath ();
  33. });
  34. //--> </Script>
  35. </Head>
  36. <Body>
  37. <CanvasId = "myCanvas" width = "300" height = "300">Your browser does not support HTML5 Elements</Canvas>
  38. </Body>
  39. </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.