


HTML5/CSS3 classic case - drag and drop to upload images without plug-in (1)
HTML5/CSS3 classic case - drag-and-drop upload of images without plug-ins (1):
Uploading is basically something that often occurs in projects, generally using:
1, form submission
2, flash
3, html5
Form submission will refresh the page, making it difficult to upload asynchronously; flash may be used more Because it can take into account almost all browsers, I have always used jquery's uploadify as the upload tool in the project. Uploadify is also based on html5 and seems to be paid. You can go to the official website to take a look; of course, now html5 provides API and powerful APIs such as File, FileReader, XMLHttpRequest, etc. provide the possibility for us to drag and drop to upload.
Rendering 1:
Rendering 2:
Since the local upload is too fast, I recorded an 80M gif. I can finally see the detailed effect of the upload. Isn’t it still very good? I suggest that CSDN’s blog editor also supports drag and drop upload, which saves me the trouble of looking for files. .
Due to a lot of code:
This piece mainly talks about HTML and CSS:
HTML code:
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"/> <link href="reset.css" type="text/css" rel="stylesheet"/> <link href="01.css" type="text/css" rel="stylesheet"/> </head> <body> <p id="uploadBox"> <ul> <li> <img src="/static/imghwm/default1.png" data-src="images/pic1.jpg" class="lazy" / alt="HTML5/CSS3 classic case - drag and drop to upload images without plug-in (1)" > <span class="progress"></span> <span class="percentage"></span> </li> <li> <img src="/static/imghwm/default1.png" data-src="images/pic2.jpg" class="lazy" / alt="HTML5/CSS3 classic case - drag and drop to upload images without plug-in (1)" > <span class="progress"></span> <span class="percentage">12%</span> </li> <li class="done"> <img src="/static/imghwm/default1.png" data-src="images/pic2.jpg" class="lazy" / alt="HTML5/CSS3 classic case - drag and drop to upload images without plug-in (1)" > <span class="progress"></span> <span class="percentage"></span> </li> <p class="clearfix"></p> </ul> </p> </body> </html>
It’s still very simple:
a, a p#uploadBox, in which ul li represents each uploaded image unit
b, li img Picture
c, li span.progress is used to show the progress, with the effect of rising water, from height: 0% -100%;
d, li span.percentage is used in the picture Displays 1% to 100% numbers in the center, and when 100% is reached, displays a correct image
CSS:
body { background: #eee; } #uploadBox { width: 622px; height: 362px; background-color: #fff; border: 1px solid #777; margin: 120px auto; } #uploadBox ul li { float: left; position: relative; margin-left: 5px; margin-top: 5px; } #uploadBox li img { border: 1px solid #D1D1D1; width: 198px; height: 112px; vertical-align: middle; } #uploadBox li .percentage { width: 69px; height: 69px; position: absolute; left: 50%; top: 50%; margin-left: -34.5px; margin-top: -34.5px; text-align: center; font-size: 18px; line-height: 69px; color: #fff; border-radius: 34.5px; background: rgba(0, 0, 0, .8); } #uploadBox li.done .percentage { background: url("images/done.png") no-repeat 0 0; text-indent: -1000em; } #uploadBox li .progress { position: absolute; height: 22.4px; bottom: 0px; width: 200px; background: #000; opacity: .5; } .clearfix { clear: both; }
They are all relatively simple, basically just simple use of positioning~ Take a look for yourself~
Final rendering:
The above is the detailed content of HTML5/CSS3 classic case - drag and drop to upload images without plug-in (1). For more information, please follow other related articles on the PHP Chinese website!

H5 brings a number of new functions and capabilities, greatly improving the interactivity and development efficiency of web pages. 1. Semantic tags such as enhance SEO. 2. Multimedia support simplifies audio and video playback through and tags. 3. Canvas drawing provides dynamic graphics drawing tools. 4. Local storage simplifies data storage through localStorage and sessionStorage. 5. The geolocation API facilitates the development of location-based services.

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

The core features of HTML5 include semantic tags, multimedia support, offline storage and local storage, and form enhancement. 1. Semantic tags such as, etc. to improve code readability and SEO effect. 2. Simplify multimedia embedding with labels. 3. Offline storage and local storage such as ApplicationCache and LocalStorage support network-free operation and data storage. 4. Form enhancement introduces new input types and verification properties to simplify processing and verification.

H5 provides a variety of new features and functions, greatly enhancing the capabilities of front-end development. 1. Multimedia support: embed media through and elements, no plug-ins are required. 2. Canvas: Use elements to dynamically render 2D graphics and animations. 3. Local storage: implement persistent data storage through localStorage and sessionStorage to improve user experience.

H5 and HTML5 are different concepts: HTML5 is a version of HTML, containing new elements and APIs; H5 is a mobile application development framework based on HTML5. HTML5 parses and renders code through the browser, while H5 applications need to run containers and interact with native code through JavaScript.

Key elements of HTML5 include,,,,,, etc., which are used to build modern web pages. 1. Define the head content, 2. Used to navigate the link, 3. Represent the content of independent articles, 4. Organize the page content, 5. Display the sidebar content, 6. Define the footer, these elements enhance the structure and functionality of the web page.

There is no difference between HTML5 and H5, which is the abbreviation of HTML5. 1.HTML5 is the fifth version of HTML, which enhances the multimedia and interactive functions of web pages. 2.H5 is often used to refer to HTML5-based mobile web pages or applications, and is suitable for various mobile devices.

HTML5 is the latest version of the Hypertext Markup Language, standardized by W3C. HTML5 introduces new semantic tags, multimedia support and form enhancements, improving web structure, user experience and SEO effects. HTML5 introduces new semantic tags, such as, ,, etc., to make the web page structure clearer and the SEO effect better. HTML5 supports multimedia elements and no third-party plug-ins are required, improving user experience and loading speed. HTML5 enhances form functions and introduces new input types such as, etc., which improves user experience and form verification efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
