用html实现一个文章图片缩略展示

2024-03-31 11:20

本文主要是介绍用html实现一个文章图片缩略展示,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文章图片缩略展示</title><link rel="stylesheet" href="./style.css">
</head>
<body>
<div class="carousel"><!-- 箭头绘制 --><div class="carousel_nav"><span id="moveLeft" class="carousel_arrow"><svg class="carousel_icon" width="24" height="24" viewbox="0 0 24 24"><path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"></path></svg></span><span id="moveRight" class="carousel_arrow"><svg class="carousel_icon" width="24" height="24" viewbox="0 0 24 24"><path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"></path></svg></span></div><!-- 图片文章概述 --><div class="carousel-item carousel-item--1"><div class="carousel-item_image"></div><div class="carousel-item_info"><div class="carousel-item_cantainer"><h2 class="carousel-item_subtitle">Dixie National Forest</h2><h1 class="carousel-item_title">迪克西国家森林公园</h1><p class="carousel-item_description">位于犹他州的南部,是从锡安公园走Highway89公路前往布莱斯峡谷的必经之路,占地将近200万英亩,横跨犹他州南部约170英里以及更广泛的地区,是大盆地和科罗拉多河之间的鸿沟。</p><a href="#" class="carousel-item_btn">阅读文章</a></div></div></div><div class="carousel-item carousel-item--2"><div class="carousel-item_image"></div><div class="carousel-item_info"><div class="carousel-item_container"><h2 class="carousel-item_subtitle">Bernina Alps</h2><h1 class="carousel-item_title">伯尔尼纳山</h1><p class="carousel-item_description">瑞士东部沿著意大利边境伸展的雷蒂亚阿尔卑斯山脉(Rhaetian Alps)的一部分,景色秀丽,伯尔尼纳峰高达4,049公尺(13,284尺)。</p><a href="#" class="carousel-item_btn">阅读文章</a></div></div></div><div class="carousel-item carousel-item--3"><div class="carousel-item_image"></div><div class="carousel-item_info"><div class="carousel-item_container"><h2 class="carousel-item_subtitle">Lappland</h2><h1 class="carousel-item_title">拉普兰</h1><p class="carousel-item_description">拉普兰地处芬兰最北部。这是一片充满魔幻魅力的北极地带,各种反差十分强烈。事实上,拉普兰地区的主要魅力之一就是强烈的反差:从24小时日照不断的温暖夏季,到北极光辉映下的黑暗冬日。</p><a href="#" class="carousel-item_btn">阅读文章</a></div></div></div><div class="carousel-item carousel-item--4"><div class="carousel-item_image"></div><div class="carousel-item_info"><div class="carousel-item_container"><h2 class="carousel-item_subtitle">Palawan island</h2><h1 class="carousel-item_title">巴拉望岛</h1><p class="carousel-item_description">巴拉望岛是菲律宾西部岛屿,地势狭长,面积1.1785万平方公里,人口31.1548万,巴拉望岛和周围数千个小岛仍是原始的自然生态,因此被称为“海上的乌托邦”。</p><a href="#" class="carousel-item_btn">阅读文章</a></div></div></div><div class="carousel-item carousel-item--5"><div class="carousel-item_image"></div><div class="carousel-item_info"><div class="carousel-item_container"><h2 class="carousel-item_subtitle">Grand Bazaar, Tehran</h2><h1 class="carousel-item_title">德黑兰大市集</h1><p class="carousel-item_description">德黑兰大市集是当地最大的市集, 货品包罗万有, 如果慢慢逛, 应该可以流年数小时, 但需要留意市集内很容易迷路, 价格比其他伊朗城市高,特别是一些纪念品。</p><a href="#" class="carousel-item_btn">阅读文章</a></div></div></div>
</div><!-- partial --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><script src="./script.js"></script>
</body>
</html>
$(function(){$('.carousel-item').eq(0).addClass('active');var total = $('.carousel-item').length;var current = 0;$('#moveRight').on('click', function(){var next=current;current= current+1;setSlide(next, current);});$('#moveLeft').on('click', function(){var prev=current;current = current- 1;setSlide(prev, current);});function setSlide(prev, next){var slide= current;if(next>total-1){slide=0;current=0;}if(next<0){slide=total - 1;current=total - 1;}$('.carousel-item').eq(prev).removeClass('active');$('.carousel-item').eq(slide).addClass('active');setTimeout(function(){},800);console.log('current '+current);console.log('prev '+prev);}});
@import url('https://fonts.googleapis.com/css?family=Playfair+Display:400,400i,700,700i,900,900i');@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i');* {box-sizing: border-box;
}html, body {margin: 0;padding: 0;width: 100%;height: 100%;display: flex;display: -webkit-flex;justify-content: center;-webkit-justify-content: center;align-items: center;-webkit-align-items: center;
}body {background-color: #eaeaea;
}.carousel {width: 100%;height: 100%;display: flex;max-width: 900px;max-height: 550px;   overflow: hidden;position: relative;
}.carousel-item {visibility:visible;display: flex;width: 100%;height: 100%;align-items: center;justify-content: flex-end;-webkit-align-items: center;-webkit-justify-content: flex-end;position: relative;background-color: #fff;flex-shrink: 0;-webkit-flex-shrink: 0;position: absolute;z-index: 0;transition: 0.6s all linear;
}.carousel-item_info {height: 100%;display: flex;justify-content: center;flex-direction: column;display: -webkit-flex;-webkit-justify-content: center;-webkit-flex-direction: column;order: 1;left: 0;margin: auto;padding: 0 40px;width: 40%;}.carousel-item_image {width: 60%;height: 100%;order: 2;align-self: flex-end;flex-basis: 60%;-webkit-order: 2;-webkit-align-self: flex-end;-webkit-flex-basis: 60%;background-position: center;background-repeat: no-repeat;background-size: cover;position:relative;transform: translateX(100%);transition: 0.6s all ease-in-out;
}.carousel-item_subtitle {font-family: 'Open Sans', sans-serif;letter-spacing: 3px;font-size: 10px;text-transform: uppercase;margin: 0;color: #7E7E7E;    font-weight: 700;transform: translateY(25%);opacity: 0;visibility: hidden;transition: 0.4s all ease-in-out;
}.carousel-item_title {margin: 15px 0 0 0;font-family: 'Playfair Display', serif;font-size: 44px;line-height: 45px;letter-spacing: 3px;font-weight: 700;color: #2C2C2C;transform: translateY(25%);opacity: 0;visibility: hidden;transition: 0.6s all ease-in-out;
}.carousel-item_description {transform: translateY(25%);opacity: 0;visibility: hidden;transition: 0.6s all ease-in-out;margin-top: 35px;font-family: 'Open Sans', sans-serif;font-size: 13px;color: #7e7e7e;line-height: 22px;margin-bottom: 35px;
}.carousel-item--1 .carousel-item_image{background-image: url('https://source.unsplash.com/g31xUUbN_Go');
}.carousel-item--2 .carousel-item_image{background-image: url('https://source.unsplash.com/BqkbDOVoiyk');
}.carousel-item--3 .carousel-item_image{background-image: url('https://source.unsplash.com/wuH_U6EUyQI');
}.carousel-item--4 .carousel-item_image{background-image: url('https://source.unsplash.com/Sju9RqMILsw');
}.carousel-item--5 .carousel-item_image{background-image: url('https://source.unsplash.com/jwjGCvxjDlo');
}.carousel-item_btn {width: 35%;color: #2C2C2C;font-family: 'Open Sans', sans-serif;letter-spacing: 3px;font-size: 11px;text-transform: uppercase;margin: 0;width: 35%;font-weight: 700;text-decoration: none;transform: translateY(25%);opacity: 0;visibility: hidden;transition: 0.6s all ease-in-out;
}.carousel_nav {position: absolute;right: 0;z-index: 2;background-color: #fff;bottom: 0;
}.carousel_icon {display: inline-block;vertical-align: middle;width: 16px;fill: #5d5d5d;
}.carousel_arrow {cursor: pointer;display: inline-block;padding: 11px 15px;position: relative;
}.carousel_arrow:nth-child(1):after {content:'';right: -3px;position: absolute;width: 1px;background-color: #b0b0b0;height: 14px;top: 50%;margin-top: -7px;
}.active{z-index: 1;display: flex;visibility:visible;
}.active .carousel-item_subtitle, .active .carousel-item_title, .active .carousel-item_description,.active .carousel-item_btn{transform: translateY(0);opacity: 1;transition: 0.6s all ease-in-out;visibility: visible;
}.active .carousel-item_image{ 
transition: 0.6s all ease-in-out;
transform: translateX(0);
}

这篇关于用html实现一个文章图片缩略展示的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/864211

相关文章

HTML5 中的<button>标签用法和特征

《HTML5中的<button>标签用法和特征》在HTML5中,button标签用于定义一个可点击的按钮,它是创建交互式网页的重要元素之一,本文将深入解析HTML5中的button标签,详细介绍其属... 目录引言<button> 标签的基本用法<button> 标签的属性typevaluedisabled

HTML5实现的移动端购物车自动结算功能示例代码

《HTML5实现的移动端购物车自动结算功能示例代码》本文介绍HTML5实现移动端购物车自动结算,通过WebStorage、事件监听、DOM操作等技术,确保实时更新与数据同步,优化性能及无障碍性,提升用... 目录1. 移动端购物车自动结算概述2. 数据存储与状态保存机制2.1 浏览器端的数据存储方式2.1.

基于 HTML5 Canvas 实现图片旋转与下载功能(完整代码展示)

《基于HTML5Canvas实现图片旋转与下载功能(完整代码展示)》本文将深入剖析一段基于HTML5Canvas的代码,该代码实现了图片的旋转(90度和180度)以及旋转后图片的下载... 目录一、引言二、html 结构分析三、css 样式分析四、JavaScript 功能实现一、引言在 Web 开发中,

SpringBoot中使用Flux实现流式返回的方法小结

《SpringBoot中使用Flux实现流式返回的方法小结》文章介绍流式返回(StreamingResponse)在SpringBoot中通过Flux实现,优势包括提升用户体验、降低内存消耗、支持长连... 目录背景流式返回的核心概念与优势1. 提升用户体验2. 降低内存消耗3. 支持长连接与实时通信在Sp

Conda虚拟环境的复制和迁移的四种方法实现

《Conda虚拟环境的复制和迁移的四种方法实现》本文主要介绍了Conda虚拟环境的复制和迁移的四种方法实现,包括requirements.txt,environment.yml,conda-pack,... 目录在本机复制Conda虚拟环境相同操作系统之间复制环境方法一:requirements.txt方法

Spring Boot 实现 IP 限流的原理、实践与利弊解析

《SpringBoot实现IP限流的原理、实践与利弊解析》在SpringBoot中实现IP限流是一种简单而有效的方式来保障系统的稳定性和可用性,本文给大家介绍SpringBoot实现IP限... 目录一、引言二、IP 限流原理2.1 令牌桶算法2.2 漏桶算法三、使用场景3.1 防止恶意攻击3.2 控制资源

Python如何去除图片干扰代码示例

《Python如何去除图片干扰代码示例》图片降噪是一个广泛应用于图像处理的技术,可以提高图像质量和相关应用的效果,:本文主要介绍Python如何去除图片干扰的相关资料,文中通过代码介绍的非常详细,... 目录一、噪声去除1. 高斯噪声(像素值正态分布扰动)2. 椒盐噪声(随机黑白像素点)3. 复杂噪声(如伪

springboot下载接口限速功能实现

《springboot下载接口限速功能实现》通过Redis统计并发数动态调整每个用户带宽,核心逻辑为每秒读取并发送限定数据量,防止单用户占用过多资源,确保整体下载均衡且高效,本文给大家介绍spring... 目录 一、整体目标 二、涉及的主要类/方法✅ 三、核心流程图解(简化) 四、关键代码详解1️⃣ 设置

Python中图片与PDF识别文本(OCR)的全面指南

《Python中图片与PDF识别文本(OCR)的全面指南》在数据爆炸时代,80%的企业数据以非结构化形式存在,其中PDF和图像是最主要的载体,本文将深入探索Python中OCR技术如何将这些数字纸张转... 目录一、OCR技术核心原理二、python图像识别四大工具库1. Pytesseract - 经典O

Nginx 配置跨域的实现及常见问题解决

《Nginx配置跨域的实现及常见问题解决》本文主要介绍了Nginx配置跨域的实现及常见问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来... 目录1. 跨域1.1 同源策略1.2 跨域资源共享(CORS)2. Nginx 配置跨域的场景2.1