《Using the HTML5 Canvas element in the real world》 -----本字幕由雷天音 整理制作----- Since the canvas tag is new to HTML5, there are going to be browsers out there
【----QQ 568031962----】 that don't support it.
【----ACELY STUDIO----】 So let's take a quick look at what happens when a browser that is not aware of
the canvas tag encounters one in a document.
So here we have a canvas, and inside we have some text.
Now in browsers that understand what the canvas tag is, this text will not show
up and will instead be replaced by the canvas itself in the rendering surface.
A browser that does not understand the canvas tag will ignore it and render the
contents of the interior of the canvas tag instead.
In this case, let's just quickly show you what I'm talking about.
What I'm going to do is simulate a browser that does not understand canvas, since
all the browsers I have on this machine know about it.
So I'll just quickly comment this out and will comment this one out as well.
This is pretty much how the browser will treat the canvas tag if it
doesn't recognize it.
So now let's just quickly take a look at that.
So you can see that in the case where a browser doesn't know what the canvas tag
is, the interior text gets rendered instead.
So that will happen in cases where you have an older browser and it comes across
a canvas tag, or generally speaking, pretty much any tag it doesn't recognize.
But in the case where the browser does understand what the canvas tag is--
let's go back and uncomment it, save--and you can see that I've got a
style defined for this canvas up here with a dotted 3-pixel black border
and a background color.
So it should render as a gray square with a border.
Let's go back to the browser and refresh.
-----本字幕由雷天音 整理制作----- -----更多Lynda字幕请访问我的人人----- -----联系邮箱：acely@126.com----- So I am going to refresh this now, and you can see that in a browser that does
understand the canvas tag, it does show up, and it's properly styled.