<!DOCTYPE html>
<html>
<head>
	<title>图片链接</title>
	<style>
		.link {
			display: inline-block;
			border: 1px solid black;
			padding: 10px;
			text-align: center;
			text-decoration: none;
			color: black;
			font-weight: bold;
			font-size: 18px;
			background-image: url('https://images.unsplash.com/photo-1547721064-da6cfb341d50');
			background-size: cover;
			background-repeat: no-repeat;
			background-position: center;
		}
	</style>
</head>
<body>
	<a href="https://unsplash.com/photos/JxJvRnQ1H5E" target="_blank" class="link">点击查看图片</a>
</body>
</html> 
<p>注:以上代码中的图片链接为 https://unsplash.com/photos/JxJvRnQ1H5E,可以替换为其他图片链接。</p>
以HTML和CSS写一个图片链接

原文地址: https://www.cveoy.top/t/topic/YUG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录