HTML响应所有设备

时间:2017-06-10 21:33:20

标签: javascript html css

我尝试了各种各样的东西,但是当你拖动窗口或使用手机时我无法让我的网页自动缩放,我创建了script.js和css。

这是代码,你能告诉我或给我发送css和js的代码吗?

谢谢,抱歉

<html xmlns="http://www.w3.org/1999/xhtml" class="sr-lang-en" lang="en"
<head>
  <link rel="stylesheet" type="text/css" href="design.css">
  <meta name=viewport content="width=device-width, initial-scale=1">
  <title>Rivalo Willkommensbonus </title>
  <link rel="shortcut icon" href="/favicon.ico" />
  <link rel="icon" href="/favicon.ico" type="image/ico" />
</head>
<div id="content">
  <body class="theme">
    <div id="themeBackground" style="background: url(bg.jpg);padding-top:130px;padding-left:00px;padding-bottom:130px;">
      <div class="wrapper">
        <div class="container">
          <center>
            <div id="content" class="left">
              <div id="main_wide">
                <div class="cms_richtext">
                  <div class="box">
                    <a href="https://www.rivalo.com/de/wettkonto-anmelden/">
                      <div style="background:url(header_de_main-min.jpg) top center no-repeat;width:1011px;height:494px;"></div>
                    </a>
                    <div style="margin-top:20px;margin-left:40px;width:950px;">
                      <a href="https://www.rivalo.com/de/wettkonto-anmelden/">
                        <style scope="" type="text/css">
                          div.box1 {
                          opacity: 0.9;
                          filter: alpha(opacity=90); /* For IE8 and earlier */
                          }
                          div.box1:hover {
                          opacity: 1.0;
                          filter: alpha(opacity=100); /* For IE8 and earlier */
                          -webkit-box-shadow: inset 0px 0px 0px 1px rgba(255,255,255,1); 
                          -moz-box-shadow: inset 0px 0px 0px 1px rgba(255,255,255,1); 
                          box-shadow: inset 0px 0px 0px 1px rgba(255,255,255,1);
                          }                 
                        </style>
                      </a>
                      <a href="https://www.rivalo.com/de/casino-spielen/">
                        <div class="box1" style="width:219px;height:173px;float:left;background:url(header_de_1-min.jpg) top center no-repeat;margin-right:9px">&nbsp;</div>
                      </a>
                      <a href="https://www.rivalo.com/de/live-wetten/">
                        <div class="box1" style="width:220px;height:173px;float:left;background:url(header_de_2-min.jpg) top center no-repeat;margin-right:9px;margin-left:9px">&nbsp;</div>
                      </a>
                      <a href="https://www.rivalo.com/de/sportwetten-bonus/">
                        <div class="box1" style="width:220px;height:173px;float:left;background:url(header_de_3-min.jpg) top center no-repeat;margin-right:9px;margin-left:9px">&nbsp;</div>
                      </a>
                      <a href="https://www.rivalo.com/de/wettkonto-anmelden/">
                        <div class="box1"style="width:220px;height:173px;float:left;background:url(header_de_4-min.jpg) top center no-repeat;margin-right:9px;margin-left:9px">&nbsp;</div>
                      </a>
                      <div style="clear:both">&nbsp;</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
        </div>
      </div>
    </div>
</div>
</center>
<script type="text/javascript">
  TableHeight();
</script>
</body>
</html>

3 个答案:

答案 0 :(得分:0)

您在代码的以下行中缺少“viewport”周围的引号:

<meta name=viewport content="width=device-width, initial-scale=1">

应该是

<meta name="viewport" content="width=device-width"; initial-scale="1.0" />

答案 1 :(得分:0)

在为宽度或高度赋值时使用百分比而不是像素

答案 2 :(得分:-1)

<强>更新

有一个jquery插件可以放大/缩小所有元素,从here下载。

这是一个例子:

"abc"

查看zoomooz.js的this demo

在css3中,您可以使用@media来检测不同宽度的屏幕。看看这个example