写出对应的html和css文件,一共有五个盒子,第一个盒子上面是一个页面导航栏,导航栏有四个选项,当鼠标在某个选项时,字由黑色变为黄底白字,点击四个选项分别跳转到1-4个盒子,导航栏下是一张居中的图片,第二个盒子有一个居中的标题,里面有一个小盒子居中,黄色背景,小盒子左边是图片,右边是标题加文字加按钮,当鼠标在按钮悬停时变为红色,同时鼠标的形状变为手,第三个盒子有一个靠左的标题,里面有一个小盒子,小盒子有外边框,小盒子左侧是一张图片,右侧上方是标题,下方是文字,,小盒子下面是两个方形按钮,点击按钮分别切换上一张和下一张,第四个盒子,上方标题居中,然后有三个小盒子水平放置,每个小盒子布局从上到下,是图片、小标题、大标题、正文、按钮,按钮在鼠标悬停时变色,第五个盒子是页脚区,将文字均分三份,水平放置

时间: 2024-03-11 16:49:39 浏览: 17
HTML文件: ``` <!DOCTYPE html> <html> <head> <title>My Webpage</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <nav> <ul> <li><a href="#section1">Section 1</a></li> <li><a href="#section2">Section 2</a></li> <li><a href="#section3">Section 3</a></li> <li><a href="#section4">Section 4</a></li> </ul> </nav> <section id="section1"> <img src="image.jpg"> </section> <section id="section2"> <h1>Title</h1> <div class="box1"> <img src="image.jpg"> <div class="box1-text"> <h2>Title</h2> <p>Text</p> <button>Button</button> </div> </div> </section> <section id="section3"> <h1 class="left">Title</h1> <div class="box2"> <img src="image.jpg"> <div class="box2-text"> <h2>Title</h2> <p>Text</p> <div class="box2-buttons"> <button>Previous</button> <button>Next</button> </div> </div> </div> </section> <section id="section4"> <h1>Title</h1> <div class="box3"> <div class="box3-item"> <img src="image.jpg"> <h3>Subtitle</h3> <h2>Title</h2> <p>Text</p> <button>Button</button> </div> <div class="box3-item"> <img src="image.jpg"> <h3>Subtitle</h3> <h2>Title</h2> <p>Text</p> <button>Button</button> </div> <div class="box3-item"> <img src="image.jpg"> <h3>Subtitle</h3> <h2>Title</h2> <p>Text</p> <button>Button</button> </div> </div> </section> <footer> <div class="footer-item"> <p>Text 1</p> </div> <div class="footer-item"> <p>Text 2</p> </div> <div class="footer-item"> <p>Text 3</p> </div> </footer> </body> </html> ``` CSS文件: ``` body { margin: 0; padding: 0; font-family: Arial, sans-serif; } nav { background-color: #333; color: #fff; padding: 10px 0; } nav ul { list-style: none; margin: 0; padding: 0; text-align: center; } nav li { display: inline-block; margin: 0 10px; } nav a { color: #fff; text-decoration: none; padding: 5px 10px; border-radius: 5px; transition: all 0.3s ease; } nav a:hover { background-color: #ffc107; color: #333; } section { padding: 50px 0; text-align: center; } section img { max-width: 100%; height: auto; } h1 { font-size: 36px; margin-bottom: 30px; } .box1 { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; background-color: #ffc107; padding: 30px; } .box1 img { max-width: 100%; height: auto; flex-basis: 40%; margin-right: 30px; } .box1-text { flex-basis: 60%; text-align: left; } .box1-text h2 { font-size: 24px; margin-bottom: 15px; } .box1-text p { font-size: 16px; margin-bottom: 15px; } .box1-text button { background-color: #ffc107; color: #fff; padding: 10px 20px; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: all 0.3s ease; } .box1-text button:hover { background-color: #e60000; } .left { text-align: left; } .box2 { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; border: 2px solid #333; padding: 30px; } .box2 img { max-width: 100%; height: auto; flex-basis: 40%; margin-right: 30px; } .box2-text { flex-basis: 60%; text-align: left; } .box2-text h2 { font-size: 24px; margin-bottom: 15px; } .box2-text p { font-size: 16px; margin-bottom: 15px; } .box2-buttons { display: flex; justify-content: center; align-items: center; margin-top: 30px; } .box2-buttons button { background-color: #ffc107; color: #fff; padding: 10px 20px; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: all 0.3s ease; } .box2-buttons button:hover { background-color: #e60000; } .box3 { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; } .box3-item { background-color: #ffc107; padding: 30px; margin: 30px; flex-basis: calc(33.33% - 60px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; } .box3-item img { max-width: 100%; height: auto; margin-bottom: 15px; } .box3-item h3 { font-size: 18px; margin-bottom: 15px; } .box3-item h2 { font-size: 24px; margin-bottom: 15px; } .box3-item p { font-size: 16px; margin-bottom: 15px; } .box3-item button { background-color: #ffc107; color: #fff; padding: 10px 20px; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: all 0.3s ease; } .box3-item button:hover { background-color: #e60000; } footer { display: flex; justify-content: space-between; align-items: center; background-color: #333; color: #fff; padding: 20px; } .footer-item { flex-basis: calc(33.33% - 20px); text-align: center; } .footer-item p { font-size: 16px; margin: 0; } ```

相关推荐

最新推荐

recommend-type

css3与html5实现响应式导航菜单(导航栏)效果分享

使用纯CSS来实现的一个响应式导航菜单,我们使用的是HTML5+CSS3技术,当浏览器窗口变小或者使用手机浏览器访问的时候,原本横条菜单会收缩成一个下拉菜单,当鼠标滑向菜单时下拉展示全部菜单
recommend-type

html+css 实现简易导航栏功能

主要介绍了基于html+css 实现简易导航栏功能,主要就是css(级联样式表)对html的内容做格式化。具体内容详情大家跟随小编一起通过本文学习吧
recommend-type

基于html和CSS3制作酷炫的导航栏

 5 使用html + css3 渐变画图 制作背景图片  6 更改颜色透明度  7 DIV制作边框阴影 先看效果图:   CSS Code复制内容到剪贴板 &lt;!doctype html&gt;  html lang="en"&gt;  &lt;head&gt;  &lt;meta ...
recommend-type

css3实现一个div设置多张背景图片及background-image属性实例演示

主要介绍了css3实现一个div设置多张背景图片及background-image属性,同时对于css3背景渐变也做了详细的解释,水平渐变,左上角渐变等等方式,需要的朋友可以参考下
recommend-type

单片机C语言Proteus仿真实例可演奏的电子琴

单片机C语言Proteus仿真实例可演奏的电子琴提取方式是百度网盘分享地址
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

用matlab绘制高斯色噪声情况下的频率估计CRLB,其中w(n)是零均值高斯色噪声,w(n)=0.8*w(n-1)+e(n),e(n)服从零均值方差为se的高斯分布

以下是用matlab绘制高斯色噪声情况下频率估计CRLB的代码: ```matlab % 参数设置 N = 100; % 信号长度 se = 0.5; % 噪声方差 w = zeros(N,1); % 高斯色噪声 w(1) = randn(1)*sqrt(se); for n = 2:N w(n) = 0.8*w(n-1) + randn(1)*sqrt(se); end % 计算频率估计CRLB fs = 1; % 采样频率 df = 0.01; % 频率分辨率 f = 0:df:fs/2; % 频率范围 M = length(f); CRLB = zeros(M,1); for
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。