HTML+CSS实现——响应式卡片页面

简介: 本篇文章,主要讲解一下如何创建一个响应式卡片页面

本篇文章,主要讲解一下如何创建一个响应式卡片页面


响应式卡片效果图

292e13c427cbed830ae5fdd7ab30b9b.png


HTML部分(index.html)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <link rel="stylesheet" href="style.css">
    <title>响应式卡片</title>
</head>
<link href="http://175.178.184.206/usr/uploads/2022/05/2356336909.png" mce_href="favicon.ico" rel="icon" type="image/x-icon"/>
<body>
    <div class="container">
        <!-- 01 card -->
        <div class="card">
            <div class="circle">
                <h2>Email</h2>
            </div>
            <div class="content">
                <p>Welcome To Mango Diary<br></p>
                <p>Click the button below to tell you what you want to whisper to me</p>
                <a href="#">Post Here</a>
            </div>
        </div>
        <!-- 02 card -->
        <div class="card">
            <div class="circle">
                <h2>Photo</h2>
            </div>
            <div class="content">
                <p>Welcome To Photo Waterfall<br></p>
                <p>Through the days when no one cares, there is poetry and distance</p>
                <a href="#">Read More</a>
            </div>
        </div>
        <!-- 03 card  -->
        <div class="card">
            <div class="circle">
                <h2>Moon</h2>
            </div>
            <div class="content">
                <p>I've always wanted to see the moon from your window. You can see it more clearly in this room than in that one</p>
                <a href="#">Read More</a>
            </div>
        </div>
    </div>
</body>
</html>

CSS部分(style.css)

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700&display=swap');
* {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(45deg,#ffaf00, #bb02ff);
    background-attachment: fixed;
}
.container {
    position: relative;
    width: 1150px;
    padding:20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.container .card {
    position: relative;
    width: 300px;
    height: 480px;
    background: #fff;
    margin: 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 25px rgba(0, 0 ,0 , .2);
    transition: 0.5s;
}
.container:hover .card{
    filter: blur(20px);
    transform: scale(0.9);
    opacity: .5;
}
.container .card:hover{
    filter: blur(0px);
    transform: scale(1.1);
    opacity: 1;
}
.container .card .circle {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    clip-path: circle(180px at center 0);
    text-align: center;
}
.container .card .circle h2{
    color: #fff;
    font-size: 4.5em;
    padding: 30px 0;
}
.container .card .content {
    position: absolute;
    bottom: 10px;
    padding: 20px;
    text-align: center;
} 
.container .card .content p {
    color: #666;
}
.container .card .content a {
    position: relative;
    display: inline-block;
    padding: 10px 20px;
    background: #000;
    border-radius: 40px;
    text-decoration: none;
    margin-top: 20px;
    color: #fff;
}
.container .card:nth-child(1) .circle,
.container .card:nth-child(1) .content a{
    background: #ffaf00;
}
.container .card:nth-child(2) .circle,
.container .card:nth-child(2) .content a{
    background: #da2268;
}
.container .card:nth-child(3) .circle,
.container .card:nth-child(3) .content a{
    background: #bb02ff;
}
.container .card:nth-child(4) .circle,
.container .card:nth-child(4) .content a{
    background: #bb02ff;
}
.container .card:nth-child(5) .circle,
.container .card:nth-child(5) .content a{
    background: #bb02ff;
}

注意事项

以上两个文件须使用括号内的名字命名并且放在同一目录下才可

目录
相关文章
|
6天前
|
Web App开发 API
通过html页面方式访问www.iximo.com的方式(原创)
通过html页面方式访问www.iximo.com的方式(原创)
16 2
|
6天前
|
移动开发 前端开发 HTML5
HTML5作业(六)-----响应式放大悬浮菜单
本实验旨在熟悉CSS3的transition动画和阴影效果,任务是创建一个响应式放大悬浮菜单。当鼠标悬停在菜单上时,菜单会放大并添加立体阴影。代码示例包括设置背景色、字体样式、flex布局以及菜单项的样式和过渡效果。HTML结构包含导航菜单的链接,应用了外部CSS文件中的样式。
|
6天前
|
移动开发 HTML5
HTML5/CSS3粒子效果进度条代码
HTML5/CSS3进度条应用。这款进度条插件在播放进度过程中出现粒子效果,就像一些小颗粒从进度条上散落下来
19 0
HTML5/CSS3粒子效果进度条代码
|
6天前
|
移动开发 前端开发 JavaScript
:掌握移动端开发:HTML5 与 CSS3 的高效实践
:掌握移动端开发:HTML5 与 CSS3 的高效实践 “【5月更文挑战第6天】”
27 1
|
6天前
|
缓存 移动开发 前端开发
【专栏:HTML与CSS前端技术趋势篇】HTML与CSS在PWA(Progressive Web Apps)中的应用
【4月更文挑战第30天】PWA(Progressive Web Apps)结合现代Web技术,提供接近原生应用的体验。HTML在PWA中构建页面结构和内容,响应式设计、语义化标签、Manifest文件和离线页面的创建都离不开HTML。CSS则用于定制主题样式、实现动画效果、响应式布局和管理字体图标。两者协同工作,保证PWA在不同设备和网络环境下的快速、可靠和一致性体验。随着前端技术进步,HTML与CSS在PWA中的应用将更广泛。
|
6天前
|
前端开发 JavaScript 开发者
【专栏:HTML与CSS前端技术趋势篇】前端框架(React/Vue/Angular)与HTML/CSS的结合使用
【4月更文挑战第30天】前端框架React、Vue和Angular助力UI开发,通过组件化、状态管理和虚拟DOM提升效率。这些框架与HTML/CSS结合,使用模板语法、样式管理及组件化思想。未来趋势包括框架简化、Web组件标准采用和CSS在框架中角色的演变。开发者需紧跟技术发展,掌握新工具,提升开发效能。
|
6天前
|
前端开发 JavaScript UED
【专栏:HTML 与 CSS 前端技术趋势篇】Web 性能优化:CSS 与 HTML 的未来趋势
【4月更文挑战第30天】本文探讨了CSS和HTML在Web性能优化中的关键作用,包括样式表压缩、选择器优化、DOM操作减少等策略。随着未来趋势发展,CSS模块系统、自定义属性和响应式设计将得到强化,HTML新特性也将支持复杂组件构建。同时,应对浏览器兼容性、代码复杂度和性能功能平衡的挑战是优化过程中的重要任务。通过案例分析和持续创新,我们可以提升Web应用性能,创造更好的用户体验。
|
前端开发
页面打印 css
CSS打印分页 page-break-before : auto | always | avoid | left | right | null   参数:  auto :  假如需要在对象之前插入页分割符always :  始终在对象之前插入页分割符avoid :  避免在对象前面插入页分割符left :  在对象前面插入页分割符直到它到达一个空白的左页边right :  在对象前面插入页分割符直到它到达一个空白的右页边null :  空值。
635 0
|
6天前
|
移动开发 前端开发 UED
【专栏:HTML与CSS前端技术趋势篇】渐进式增强与优雅降级在前端开发中的实践
【4月更文挑战第30天】前端开发中的渐进式增强和优雅降级是确保跨浏览器、跨设备良好用户体验的关键策略。渐进式增强是从基础功能开始,逐步增加高级特性,保证所有用户能访问基本内容;而优雅降级则是从完整版本出发,向下兼容,确保低版本浏览器仍能使用基本功能。实践中,遵循HTML5/CSS3规范,使用流式布局和响应式设计,检测浏览器特性,并提供备选方案,都是实现这两种策略的有效方法。选择合适策略优化网站,提升用户体验。
|
6天前
|
前端开发 开发者 UED
【专栏:HTML与CSS前端技术趋势篇】网页设计中的CSS Grid与Flexbox之争
【4月更文挑战第30天】本文对比了CSS Grid和Flexbox两种布局工具。Flexbox擅长一维布局,简单易用,适合导航栏和列表;CSS Grid则适用于二维布局,能创建复杂结构,适用于整个页面布局。两者各有优势,在响应式设计中都占有一席之地。随着Web标准发展,它们的结合使用将成为趋势,开发者需掌握两者以应对多样化需求。