请用html+css写一个今日头条的移动端页面
时间: 2024-06-11 08:05:44 浏览: 11
很抱歉,作为AI语言模型,我无法提供图形用户界面。但是,我可以提供示例代码供您参考:
<!DOCTYPE html>
<html>
<head>
<title>今日头条</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<h1>今日头条</h1>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">热点</a></li>
<li><a href="#">视频</a></li>
<li><a href="#">社会</a></li>
<li><a href="#">科技</a></li>
<li><a href="#">娱乐</a></li>
<li><a href="#">体育</a></li>
<li><a href="#">军事</a></li>
</ul>
</nav>
</header>
<main>
<section class="carousel">
<div class="carousel-item active">
<img src="https://picsum.photos/id/10/640/360" alt="carousel item">
<h2>标题1</h2>
<p>这里是描述1</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/20/640/360" alt="carousel item">
<h2>标题2</h2>
<p>这里是描述2</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/30/640/360" alt="carousel item">
<h2>标题3</h2>
<p>这里是描述3</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/40/640/360" alt="carousel item">
<h2>标题4</h2>
<p>这里是描述4</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/50/640/360" alt="carousel item">
<h2>标题5</h2>
<p>这里是描述5</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/60/640/360" alt="carousel item">
<h2>标题6</h2>
<p>这里是描述6</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/70/640/360" alt="carousel item">
<h2>标题7</h2>
<p>这里是描述7</p>
</div>
<div class="carousel-item">
<img src="https://picsum.photos/id/80/640/360" alt="carousel item">
<h2>标题8</h2>
<p>这里是描述8</p>
</div>
</section>
<section class="news">
<h2>热点新闻</h2>
<ul>
<li>
<a href="#">
<img src="https://picsum.photos/id/100/120/80" alt="news item">
<h3>新闻标题1</h3>
<p>这里是新闻描述1</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/110/120/80" alt="news item">
<h3>新闻标题2</h3>
<p>这里是新闻描述2</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/120/120/80" alt="news item">
<h3>新闻标题3</h3>
<p>这里是新闻描述3</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/130/120/80" alt="news item">
<h3>新闻标题4</h3>
<p>这里是新闻描述4</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/140/120/80" alt="news item">
<h3>新闻标题5</h3>
<p>这里是新闻描述5</p>
</a>
</li>
</ul>
</section>
<section class="videos">
<h2>热门视频</h2>
<ul>
<li>
<a href="#">
<img src="https://picsum.photos/id/150/120/80" alt="video item">
<h3>视频标题1</h3>
<p>这里是视频描述1</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/160/120/80" alt="video item">
<h3>视频标题2</h3>
<p>这里是视频描述2</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/170/120/80" alt="video item">
<h3>视频标题3</h3>
<p>这里是视频描述3</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/180/120/80" alt="video item">
<h3>视频标题4</h3>
<p>这里是视频描述4</p>
</a>
</li>
<li>
<a href="#">
<img src="https://picsum.photos/id/190/120/80" alt="video item">
<h3>视频标题5</h3>
<p>这里是视频描述5</p>
</a>
</li>
</ul>
</section>
</main>
<footer>
<p>版权所有:今日头条</p>
</footer>
</body>
</html>
/* CSS */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
background-color: #f5f5f5;
color: #333;
}
header {
background-color: #fff;
padding: 20px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
header h1 {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
nav ul {
list-style: none;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
nav li {
margin: 0 10px;
}
nav a {
display: block;
padding: 10px;
color: #333;
text-decoration: none;
}
nav a:hover {
background-color: #f5f5f5;
}
main {
padding: 20px;
}
.carousel {
position: relative;
height: 360px;
overflow: hidden;
margin-bottom: 20px;
}
.carousel .carousel-item {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.carousel .carousel-item.active {
opacity: 1;
}
.carousel img {
width: 100%;
height: 100%;
object-fit: cover;
}
.carousel h2 {
position: absolute;
bottom: 20px;
left: 20px;
font-size: 20px;
color: #fff;
}
.carousel p {
position: absolute;
bottom: 0;
left: 20px;
font-size: 14px;
color: #fff;
}
.news, .videos {
margin-bottom: 20px;
}
.news h2, .videos h2 {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.news ul, .videos ul {
list-style: none;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.news li, .videos li {
width: calc(50% - 10px);
margin-bottom: 10px;
background-color: #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.news a, .videos a {
display: block;
padding: 10px;
color: #333;
text-decoration: none;
}
.news a:hover, .videos a:hover {
background-color: #f5f5f5;
}
.news img, .videos img {
display: block;
margin: 0 auto;
max-width: 100%;
height: auto;
}
.news h3, .videos h3 {
font-size: 16px;
font-weight: bold;
margin: 10px 0;
}
.news p, .videos p {
font-size: 14px;
margin-bottom: 10px;
}
footer {
background-color: #ddd;
padding: 10px;
text-align: center;
font-size: 12px;
}
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)