CSS3实现超酷的黑猫警长首页
author:一佰互联 2019-04-21   click:204

先看看效果图:

具体代码:

XML/HTML Code复制内容到剪贴板
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  4. <title>text-shadow</title>  
  5. <style type="text/css">  
  6. body {/*清除页边距,设计主色调*/   
  7.     padding: 0px;   
  8.     margin: 0px;   
  9.     color: #666;   
  10. }   
  11. #text-shadow-box {/*设计盒子外框样式*/   
  12.     position: relative;/*让内部的定位元素以这个框为参照物*/   
  13.     width: 598px;   
  14.     height: 406px;   
  15.     background: #666;   
  16.     overflow: hidden;/*禁止内容超过设定的区域*/   
  17.     border: #333 1px solid;   
  18. }   
  19. #text-shadow-box div.wall {/*设置背景墙样式*/   
  20.     position: absolute;   
  21.     width: 100%;   
  22.     top: 175px;   
  23.     left: 0px   
  24. }   
  25. #text {/*设计导航文本样式*/   
  26.     text-align: center;   
  27.     line-height: 0.5em;   
  28.     margin: 0px;   
  29.     font-family: helvetica, arial, sans-serif;   
  30.     height: 1px;   
  31.     color: #999;   
  32.     font-size: 80px;   
  33.     font-weight: bold;   
  34.     text-shadow: 5px -5px 16px #000;/*设计右上偏移的阴影,适当进行模糊处理,产生色晕效果,阴影色为深色,营造静谧的效果*/   
  35. }   
  36. div.wall div {/*设计前面挡风板样式*/   
  37.     position: absolute;   
  38.     width: 100%;   
  39.     height: 300px;   
  40.     top: 42px;   
  41.     left: 0px;   
  42.     background: #999;   
  43. }   
  44. #spotlight {/*设计覆盖在上面的探照灯效果图*/   
  45.     position: absolute;/*设计一个层,让其覆盖在页面上,并使其满窗口显示,通过前期设计好的一个探照灯背景来营造神秘效果*/   
  46.     width: 100%;   
  47.     height: 100%;   
  48.     top: 0px;   
  49.     left: 0px;   
  50.     background: url(images/spotlight.png) center -300px;   
  51. }   
  52. #spotlight a {   
  53.     color:#ccc;   
  54.     text-decoration:none;   
  55.     position:absolute;   
  56.     left:47%;   
  57.     top:56%;   
  58.     float:left;   
  59. }   
  60. a img { border:none; }   
  61. </style>  
  62. </head>  
  63.   
  64. <body>  
  65. <!--本案例的结构外套-->  
  66. <div id="text-shadow-box">  
  67.     <!--墙体外结构-->  
  68.     <div class="wall">  
  69.         <p id="text">黑猫警长</p>  
  70.         <div></div>  
  71.     </div>  
  72.      <!--外罩,通过他可以为页面覆盖一层桌纸,添加特殊的艺术效果-->  
  73.     <div id="spotlight"><a href="index.htm"><img src="images/cat1.png" /></a></div>  
  74. </div>  
  75. </body>  
  76. </html>  

以上就是本文的全部内容,希望对大家的学习有所帮助。