zoukankan      html  css  js  c++  java
  • 首页背景图自适应

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>首页背景图自适应</title>
    <style type="text/css">
    #home_con{ position:relative; 100%; overflow:hidden; height:824px; background:url(images/banner.jpg) no-repeat center center; background-size:100% auto;}
    #home_con .word{ position:absolute; left:50%; 814px; height:114px; margin-left:-407px; color:#fefefe; top:92px; text-align:center;}
    #home_con .word h3{ margin-bottom:8px;}
    #home_con .word h3 span{ font-size:25px; font-weight:bold; line-height:33px; letter-spacing:1px; border-bottom:2px solid #cfd6e4;border-bottom:2px solid rgba(255,255,255,0.35);}
    #home_con .word p span{ font-size:16px; text-align:center; padding:0 21px;}
    #home_con .word a{ display:block; text-align:center; margin-top:28px; font-size:14px; color:#fff; }
    #home_con .word a:hover{ text-decoration:underline;}
    </style>
    </head>
    <body>

    <div id="header"></div>
    <div id="home_con">
      <div class="word">
      <h3><span>SYNERGISTIC INVESTMENT FOR SUSTAINABLE ECONONIC GROWTH</span></h3>
      <p><span>INVESTMENT</span><span>MANAGEMENT</span><span>SYNERGY</span><span>GROWTH</span><span>PROSPERITY</span>
      </p>
      <a href="About.shtml">More About CASIF &gt;</a>
      </div>
    </div>
    <div id="footer"></div>

    </body>
    </html>
    <script>
    $(function(){
    var conH=$(window).height()-$("#header").outerHeight()-$("#footer").outerHeight();
    if($(window).width()/conH>=2.33){
    $("#home_con").height(conH);
    $("#home_con").css({ "background-size":"100% auto"});
    }
    else{
    $("#home_con").height(conH);
    $("#home_con").css({ "background-size":"auto 100%"});
    }

    $(window).resize(function(){
    var conH=$(window).height()-$("#header").outerHeight()-$("#footer").outerHeight();;
    if($(window).width()/conH>=2.33){
    $("#home_con").height(conH);
    $("#home_con").css({ "background-size":"100% auto"});
    }
    else{
    $("#home_con").height(conH);
    $("#home_con").css({ "background-size":"auto 100%"});
    }
    });
    });
    </script>

  • 相关阅读:
    Min_25筛
    POJ-1068 Parencodings---模拟括号的配对
    POJ-3295 Tautology---栈+表达式求值
    POJ-2586 Y2K Accounting Bug贪心,区间盈利
    POJ-1328 Radar Installation--区间选点问题(贪心)
    POJ-2965 The Pilots Brothers' refrigerator---思维题
    POJ-1753 Flip Game---二进制枚举子集
    南阳OJ-2-括号配对问题---栈的应用
    hdu-1082 Matrix Chain Multiplication---栈的运用
    hdu-1237 简单计算器---中缀表达式转后缀表达式
  • 原文地址:https://www.cnblogs.com/xiaoky/p/3835445.html
Copyright © 2011-2022 走看看