A picture shows the HTML5 layout (figure) and html5 Layout

Source: Internet
Author: User

A picture shows the HTML5 layout (figure) and html5 Layout


Html5 two canvas overlapping put in a div, each canvas fill in an image, how to write the code?

Specify the postion: absolution of the two canvas, and set the left and top attributes of the two canvas. It is recommended that you put a small canvas on it, the method is to set the z-index of the two canvas to different values, and the value is greater than above.
For the drawing process, refer to the code below:
Var mycanvas = document. getElementByIdx_x_x_x ("mycanvas ");
Var context = mycanvas. getContext ("2d ");
Var imageObj = new Image ();
ImageObj. onload = function (){

// Draw cropped image
Var sourcex= 350;
Var sourceY = 50;
Var sourceWidth = 350;
Var sourceHeight = 350;
Var destWidth = sourceWidth;
Var destHeight = sourceHeight;
Var destX = mycanvas. width/2-destWidth/2;
Var destY = mycanvas. height/2-destHeight/2;
Context. drawImage (imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight );
 
How can I add several icons to a background image using html5 css canvas?

Add float: left to the style of each icon to display it in one row. Adjust their distance through margin or padding!
 

Related Article

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.