ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

原生js实现图片单张上传及批量上传

2022-07-25 19:00:18  阅读:186  来源: 互联网

标签:margin align 240px height width position js 上传 单张


效果图:
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>pc图片上传</title>
    <style>
.up{ display: inline-block; vertical-align: middle; border:1px solid #eaeaea;box-sizing: border-box; text-align: left; margin-right: 20px;
    margin-bottom: 20px; width:240px; height: 240px; }
    .tips{color: #999999;text-align: center;position: absolute;bottom:0;left: 96px;}
    .Input{ position: relative; width: 240px; height: 240px; background: url(add.png)no-repeat center center; }//这里的图片背景源文件在下面。
    .on{ position: relative; display: inline-block; text-align: left; margin-right: 20px; margin-bottom: 20px; width: 240px; height: 240px; display: none; position: relative; overflow: hidden; line-height: 200px; }
    /*新增加的img*/
    .on img{ width: 100%; height: auto; position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin:auto; }
    .on div{position: absolute; height: 40px;width: 100%;bottom: 12px;z-index: 10;text-align: center;}
    .on div p:nth-child(1){ float: left; width: 50%; line-height: 40px; font-size: 14px; cursor: pointer; color: #666666; background-color: #f4f4f4; }
    .on div p:nth-child(2){ cursor: pointer; float: left; width: 50%; font-size: 14px; color: #666666; line-height: 40px; background-color: #f8f8f8; }
    .up input{ width: 240px; height: 240px; opacity: 0; }
    .button{ margin-top: 30px; }
    /*批量上传*/
    .button .set{ display: inline-block; width: 216px; height: 36px; background:url(btn_upload_off.png); background-size: 100% 100%; }
    .set input{ width: 216px; height: 36px; opacity: 0; }
    .submit{width: 100px;  text-align: center; margin-top: 20px; border: 1px solid #333333; padding: 10px 0; border-radius: 4px;}
    </style>
</head>
<body>
    <section id="content">
        <ul class="baohan">
            <li class="up">
                <div class="Input">
                    <input type="file" name="" class="fileinput">
                    <p class="tips">添加图片</p>
                </div>
                <div class="on">
                    <div>
                        <p>排序</p>
                        <p class="del">删除</p>
                    </div>
                </div>
            </li>
            <li class="up">

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/120074464

标签:margin,align,240px,height,width,position,js,上传,单张
来源: https://www.cnblogs.com/wangchuanxinshi/p/16518443.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有