ASK Question

Quick links:
Latest articles
Internship
Members

Languages:
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL

Web:
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.

Programs:
C
C++
DS
Java
C#
Python


Aptitude:
C
C++
Java
DBMS

Interview:
C
Embedded C
Java
SEO
HR

CS Subjects:
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS

More:
Articles
Puzzles
News/Updates


Home » HTML

How to make link for downloading files in HTML?



Today we will learn how we can download files from websites? Since anchor tag are used to provide links in a website. So, today we will learn how to make use of anchor tags to download different files whenever we click on links.
Submitted by Prerna Saxena, on November 09, 2017

In HTML, we have anchor tag which is used to create links. We create links by,

<a href="www.google.com">

If we want to download files whenever user clicks on a link we will use ‘download’ attribute in ‘anchor tag’. We can download various files like .pdf, .docx, .jpg etc. various different files.

We will make use of download attribute as follows,

<a href="images/logo.jpg" download>Download image</a>

Whenever we will click on Download image link, it will download the logo.jpg in your system.

HTML Code

Note: Here, I used CSS to format the page.

<!DOCTYPE html>
<html>
	<head>
		<title>My download page</title>
		<style>
			body{
				margin:0px;
				padding:0px;
			}
			h1{
				text-align:center;
				font-family:Georgia;
				color:#ffffff;
				margin:auto;
			}
			.bgimage
			{
				background-image:url('https://cdn.pixabay.com/photo/2017/10/28/23/05/background-2898451_960_720.jpg');
				background-size:cover;
				background-position:center;
			}
			.section{
				background-color:#FFEFD5;
				background-size:cover;
				text-align:center;
			}
			a:link{
				color:black;
				font-family:Georgia;
				font-size:15px;
				font-weight:bold;
			}
		</style>
	</head>
	<body>
		<header class="bgimage">
		<h1>Download Files Page</h1>
		<div class="section">
		<a href="resume.docx" download>Download Resume</a>
		</div>
		</header>
	</body>
</html>

Output (Screenshots)

make link downloadable in HTML
make link downloadable in HTML

Please share your comment if you liked the article.






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.