当前位置:首页 > 建站教程 > html+css+js实现网页中广告块代码

html+css+js实现网页中广告块代码

2年前 (2024-08-21)建站教程860
html+css+js实现网页中广告块代码

工具/原料

  • adobe dreamweaver

方法/步骤

  1. 新建html文档。
    html+css+js实现网页中广告块代码
  2. 书写hmtl代码。 <div id = "wrap"> <ul> <li class = "liA"> <div class = "divA"></div> <a href="">11111111111111<br>11111111111111</a> <div class = "divA1"></div> </li> <li  class = "liA"> <div class = "divA"></div> <a href="">11111111111111<br>11111111111111</a> <div class = "divA2"></div> </li> <li  class = "liB"> <div class = "divA"></div> <a href="">11111111111111</a> <div class = "divA1"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="" class = "aa" >11111111111111</a> <div class = "divA1"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="">11111111111111<br> 11111111111111</a> <div class = "divA2"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="" class = "aa">11111111111111</a> <div class = "divA1"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="" class = "aa">11111111111111</a> <div class = "divA2"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="">11111111111111</a> <div class = "divA1"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="">1111111111111<br> G20</a> <div class = "divA1"></div> </li> <li class = "liB"> <div class = "divA"></div> <a href="">1111111111111<br> 1111111111111</a> <div class = "divA2"></div> </li> </ul> </div>
    html+css+js实现网页中广告块代码
  3. 书写css代码。 <style> * { margin: 0; padding: 0; } a { text-decoration: none; } #wrap { width: 570px; height: 190px;margin: 100px auto; } ul li { list-style: none; } ul .liA { width: 188px; height: 88px; background: rgb(40,100,187); ; float: left; margin: 1px; position: relative; z-index: 5; overflow: hidden; } ul .liB { width: 93px; height: 88px; background: rgb(40,100,187); ; float: left; margin: 1px; position: relative; z-index: 5; overflow: hidden; } ul .liA a { font-family: arial, 'Hiragino Sans GB', 'Microsoft Yahei', 微软雅黑, 宋体, Tahoma, Arial, Helvetica, STHeiti; display: inline-block; width: 170px; height: 38px; text-align: center; color: white; position: absolute; top: 17px; left: 5px; } ul .liB a { font-family: arial, 'Hiragino Sans GB', 'Microsoft Yahei', 微软雅黑, 宋体, Tahoma, Arial, Helvetica, STHeiti; font-size: 12px; display: inline-block; width: 93px; height: 30px; text-align: center; color: white; position: absolute; top: 25px; left: 2px; } ul .liB .aa, ul .liA .aa { top: 35px } .divA { position: absolute; width: 100%; height: 100%; top: -100%; left: 0; background: #85a9e8; z-index: 0; } .divA1 { position: absolute; width: 100%; height: 100%; top: 100%; left: 0; background: #3046bb; opacity: 0.2; z-index: 0; } .divA2 { position: absolute; width: 100%; height: 100%; top: 0%; left: 0; background: white; opacity: 0.4; } </style>
    html+css+js实现网页中广告块代码
  4. 书写并添加js代码。 <script src="jquery/jquery-2.2.4.min.js"></script> <script> $(document).ready(function(){ $('.divA1').eq($(this).index()).animate({top:'0'},5) }) $('li').mouseenter(function(){ $(this).css('background-color','rgb(24,68,142)') $('.divA').eq($(this).index()).animate({top:'0'},300) $('.divA').eq($(this).index()).animate({top:'100%'},150) $('.divA1').eq($(this).index()).animate({top:'100%'},150) $(this).find('.divA2').animate({top:'100%'},300) }) $('li').mouseleave(function(){ $('.divA1').eq($(this).index()).animate({top:'0'},150) $('.divA').eq($(this).index()).animate({top:'-100%'},10) $(this).find('.divA2').animate({top:'0'},150) $(this).css('background','rgb(40,100,187)') })   </script>
    html+css+js实现网页中广告块代码
  5. 代码整体结构。
    html+css+js实现网页中广告块代码
  6. 查看效果。
    html+css+js实现网页中广告块代码
    END

扫描二维码推送至手机访问。

欢迎转载或分享本篇文章。

本文链接:https://www.jcba123.com/article/9785

分享给朋友:

“html+css+js实现网页中广告块代码” 的相关文章

WordPress如何添加视频_WordPress文章添加视频教程

WordPress如何添加视频_WordPress文章添加视频教程

WordPress默认支持视频发布功能,在实际使用中新手会有一些不懂得地方,老魏也经常见到网友对 wordpress如何添加视频有各种疑问,今天详细介绍 wordpress编辑文章时如何添加视频。 经典编辑器插入视频方法 经典编辑器是很多人在用的,插入视频有下面多种方法。 1、本地视频一般...

WordPress 如何批量修改文章信息?

你是否遇到过如下几种状况: 博客更换域名,博客文章的内容也要跟着换 使用的图片地址更换了 写了很多文章,回过头来想切换作者 想删除某个可恶留言者的所有留言 想更改某个留言者所有留言的网站URL 想要禁用所有文章的pingback 想要禁用所有文章的评...

介绍使用WordPress时10个常用的MySQL查询

多数使用 WordPress 搭建的网站,其后台都是 MySQL 数据库,经常我们需要定制 WordPress 的功能,这里我们列表 10 个最有用的 WordPress 的数据库查询,你需要一个数据库的管理工具,例如 phpMyAdmin 或者 Navicat 等来执行这些 SQL 语句。...

8个好用的WordPress RSS Feed插件

8个好用的WordPress RSS Feed插件

什么是RSS Feed? RSS代表“Really Simple Syndication”,但它也可能意味着“丰富站点摘要”或“实时简单联合组织”。这是一种基于XML的内容格式,可向用户更新所有他们喜欢的网站上的最新新闻,文章,标题和内容。 由于已经存在了很长一段时间,因此许多人都认为RSS...

“丑陋”的单页网站如何做到每月赚取 5000 美元

“丑陋”的单页网站如何做到每月赚取 5000 美元

在线赚钱是许多自由职业人的梦想,但是当真正开始时,你会意识到有很多麻烦事要做,例如创建落地页、构建登录页面、撰写 USP(独特卖点)等等。 但有时候,我们也可以跳过这些琐事,并且仍然可以赚到很多钱。 比如 diskprices ,看起来像是用 HTML 制...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。