File upload Download Style---bootstrap

Source: Internet
Author: User

In peacetime work, the file upload download function is an indispensable part. Bootstrap front-end style frames are also used more, and now customize the style of a file download based on Bootstrap's powerful style template.

Follow up with the Spring MVC framework to implement all the code for file uploads.

Take a look at the picture example: this example includes downloading the sample file style and uploading the file style.

Go directly to the code and finally explain:

<Divclass= "Form-group col-md-12 has-feedback"ID= "File">              <label for=""class= "Control-label col-md-4">Select File:</label>              <Divclass= "Col-md-4 input-group">                <inputID= "Lefile"type= "File"style= "Display:none">                <spanclass= "Input-group-addon"onclick= "$ (' input[id=lefile] ')." Click (); "style= "Cursor:pointer; Background-color: #e7e7e7"><Iclass= "fa Fa-folder-open"></I>Browse</span>                <inputID= "Photocover"class= "Form-control"type= "text">                <spanclass= "fa fa-download form-control-feedback"style= "Cursor:pointer;pointer-events:auto;"></span>              </Div>            </Div>

--------------------------------------------------------------------------------------------------------

The main technologies involved are: Bootstrap, CSS3 pointer-events, HTML5

1. HTML5 basic File Upload style

<type= "file"  name= "file">

Styles show different effects based on different browsers.

2. Font icon

You can use the bootstrap built-in glyphicons font icon, or you can use the Font awesome fonts icon. Specific use of the tutorial reference website:

glyphicons:http://v3.bootcss.com/components/#glyphicons

Font awesome:http://fontawesome.io/

In this example, two icons are used, <i class= "fa fa-folder-open" ><i class= "fa fa-download" >

or <i class= "glyphicons glyphicons-folder-open" ><i class= "Glyphicons Glyphicons-download-alt" >

3. css3:pointer-events

In Bootstrap, the. Form-control-feedback pointer-events is set to none, causing the element to be selected when the download Swatch button is clicked, and is now set to auto.

Grammar:

pointer-events: Auto | none | visiblepainted | Visiblefill | Visiblestroke | Visible | Painted | Fill | Stroke | All

default value : Auto

applies to : all elements

inheritance : There are

Animation : No

Calculated value : Specify a value

Value:

Auto: Behaves the same as when the Pointer-events property is not specified. Same as value on SVG content visiblepainted
None: The element will never be the target of a mouse event. However, when the Pointer-events property of its descendant element specifies a different value, the mouse event can point to the descendant element, in which case the mouse event will trigger the parent element's event listener in the capture or bubbling order.
Other values can only be applied to SVG.

4. Upload the file button implementation-----Bootstrap combo box Use

Use of the. Input-group and. Input-group-addon.

Specific CSS rendering self-view bootstrap source code.

5. Download the sample button implementation---Reference bootstrap form error hint style

Use of the. Has-feedback and. Form-control-feedback

File upload Download Style---bootstrap

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.