Home  >  Article  >  Web Front-end  >  Solution to inconsistent border styles when drawing rectangles on HTML5 canvas_html5 tutorial tips

Solution to inconsistent border styles when drawing rectangles on HTML5 canvas_html5 tutorial tips

WBOY
WBOYOriginal
2016-05-16 15:48:541604browse

In the past two days, I needed to use my colleague’s HTML5 drawing stuff, and found that the borders drawn by the rectangular drawing function had inconsistent styles. Finally, I found the crux of the problem through some troubleshooting methods, and now I will share it with you.

First attach the code for drawing a rectangle in HTML5:

Copy the code
The code is as follows: