请参考好客山东网写一个元素丰富的html页面。首先,我们需要理解好客山东网的基本特点和风格,以便在创作时能够准确把握其整体风格和主题。据我观察,在好客山东网上,布局 风格多样,包括全屏幕大图、网格相册、环绕文字、左右栏、卡片式、轮播图等;样式比较明亮鲜艳,以蓝色、黄色等亮色为主调,并 融合一些有韵味的活泼元素;动态效果较为丰富,包括滚动、弹窗、弹性动画、缩放、淡入淡出等。排版风格比较整洁、规范、统一 字体以宋体微软雅黑为主,对齐方式居中或靠左;色彩风格采用渐变色、矢量图等,色彩浓郁、视觉冲击力强。 根据以上特点,我们可以通过CSS实现一些基础样式,如背景颜色、字体、边框等,同时使用JS实现一些特效,如动态滑动、延迟加 载、特效展示等。请给出完整的页面代码
时间: 2023-05-25 17:04:48 浏览: 81
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>好客山东网</title>
<style>
body{
background-color: #fff;
font-family: "微软雅黑",sans-serif;
}
h1{
color:#e62328;
text-align: center;
}
#nav{
background-color: #394e6f;
padding: 10px;
color: #fff;
}
#main{
margin: 20px;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.card{
background-color: #fefefe;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
margin: 10px;
width: 300px;
height: 400px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: hidden;
position: relative;
}
.card:hover{
transform: scale(1.05);
}
.card img{
height: 300px;
object-fit: cover;
position: absolute;
left: 0;
top: 0;
transition: transform 0.5s ease-out;
}
.card:hover img{
transform: scale(1.1);
}
.card h2{
font-size: 24px;
margin: 20px;
text-align: center;
}
.card p{
font-size: 16px;
margin: 10px;
text-align: center;
line-height: 24px;
flex: 1;
overflow: hidden;
padding: 0 20px;
}
.btn{
display: block;
padding: 10px 20px;
background-color: #e62328;
color: #fff;
border: none;
border-radius: 20px;
margin: 20px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.5s ease-out;
}
.btn:hover{
background-color: #ba1f24;
}
</style>
</head>
<body>
<header id="nav">
<h1>好客山东网</h1>
</header>
<main id="main">
<div class="card">
<img src="https://picsum.photos/300/300" alt="图片1">
<h2>这是标题1</h2>
<p>这是内容1</p>
<a href="#" class="btn">查看详情</a>
</div>
<div class="card">
<img src="https://picsum.photos/300/301" alt="图片2">
<h2>这是标题2</h2>
<p>这是内容2</p>
<a href="#" class="btn">查看详情</a>
</div>
<div class="card">
<img src="https://picsum.photos/301/300" alt="图片3">
<h2>这是标题3</h2>
<p>这是内容3</p>
<a href="#" class="btn">查看详情</a>
</div>
<div class="card">
<img src="https://picsum.photos/300/302" alt="图片4">
<h2>这是标题4</h2>
<p>这是内容4</p>
<a href="#" class="btn">查看详情</a>
</div>
<div class="card">
<img src="https://picsum.photos/302/300" alt="图片5">
<h2>这是标题5</h2>
<p>这是内容5</p>
<a href="#" class="btn">查看详情</a>
</div>
<div class="card">
<img src="https://picsum.photos/300/303" alt="图片6">
<h2>这是标题6</h2>
<p>这是内容6</p>
<a href="#" class="btn">查看详情</a>
</div>
</main>
<script>
// 卡片特效
var cards = document.getElementsByClassName("card");
for(var i=0; i<cards.length; i++){
cards[i].addEventListener("mouseenter", function(){
this.querySelector("img").style.transform = "scale(1.1)";
});
cards[i].addEventListener("mouseleave", function(){
this.querySelector("img").style.transform = "";
});
}
</script>
</body>
</html>
阅读全文