如何将网站弹出窗口的html转换为移动兼容网站?

时间:2013-09-14 23:28:36

标签: javascript php html ios css

我的网站上有一个弹出窗口,其中包含以下代码,它使用async-twitter库与twitter连接/授权。

如何将以下代码转换为移动兼容网站,以便执行以下操作:

1)适用于iOS(Apple设备)上的Safari

2)以移动设备为中心而不是偏离中心......

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://platform.twitter.com/anywhere.js?id=[twitter-apikey]&v=1" type="text/javascript"></script>
<!--STYLE-->
<style type="text/css">
body {background-color: #10661A; font-family:Arial, Helvetica, sans-serif;}
#logo {background-image:url(\'img/logo.png\'); width: 770px; height: 104px;  }
#content { background-color:#FFF; width: 770px; hddeight: 334px; }
.connect { width: 249px; height:49px; display:block; background:transparent url(\'img/button.png\') center top no-repeat; }
.connect:hover { background-image: url(\'img/buttonhover.png\'); }
.title { color: #1c1c1c; padding-top: 20px; padding-left: 20px; margin-bottom: 20px; font-weight: bold; margin-top: 0px; }
.tweet { padding: 7px 100px; font-size:13px; line-height:19px; margin-left: 20px; margin-right: 20px; text-align:left; color: #343434; background-color: #eeeeee; border: 1px solid #e0e0e0; }
.link { font-style:italic; font-size:13px; line-height:19px; color: #197da4; }
.link2 { font-size:11px; text-decoration:underline; line-height:19px; color: #c2eeff; }
.account { font-weight: bold; font-size:14px; line-height:19px;  margin: 0 20px 10px 20px; padding-top: 7px; padding-bottom: 7px; text-align:center; color: #3e3e3e; background-color: #eeeeee; border: 1px solid #e0e0e0; }
.button { background-image:url(\'img/button.png\'); background-repeat:no-repeat;  color:#FFF; font-size:16px; text-decoration:none;  padding: 5px 33px 5px 33px; font-weight: bold; width: 284px; }
.ads { font-size:11px; text-align:center; color:#FFF; margin-top: 25px; }
.p1 { font-size: 13px; color: #7f7f7f; text-align:center; margin: 0px; padding-top: 10px; line-height: 18px; }
.line-separator{height:1px; border-bottom:1px solid #c8dbe3; width: 730px; margin-left: 20px; margin-top: 10px; }
</style>
<!--END STYLE-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[title]</title>
</head>

<body>
<script type="text/javascript">
    twttr.anywhere(function (T) {
        T("#tweet").linkifyUsers();
        T("#account").linkifyUsers();
        T.hovercards();
    });
</script>

<div id="logo"></div>
<div id="content">
        <p class="p1">Stuff here... Stuff here... Stuff here... Stuff here... </p>
        <p class="p1">Stuff here... Stuff here... Stuff here... Stuff here...</p>
        <div class="line-separator"></div>
        <p class="title">Stuff here... Stuff here... Stuff here... Stuff here... </p>
        <center><a href="[twitter-authorization-url]" class="connect" title="Click to authorize with twitter"></a></a></center>
</div>
<p class="ads">Copyright &copy; 2013 <a href="http://website.com/" class="link2">website</a>. All Rights Reserved.</<p> 
</body>
</html>

我非常感谢任何可能的帮助。

提前致谢 - Hyflex

1 个答案:

答案 0 :(得分:2)

1 - 尝试在百分比中的css编码

这是一个教程:percentage in css

2 - 对于移动设备添加css - 请在那里查看我的答案。

coding for mobile devices

3 - 对于不同的模式,除了全局样式外,还要保持两种样式

/* landscape */ @media screen and (orientation:landscape) 
@media screen and (orientation:portrait)

尝试一下非常灵敏的设计:)