出于某种原因,我的网站上的表格(搜索框)不会像在手机上用css编码那样向右浮动。但是,当它在笔记本电脑或ipad上时会向右浮动。让页脚实际位于页面底部我也遇到了同样的问题。我试过漂浮:右,右:0px,我甚至尝试从左边100%设置它。我应该改变什么?这是我的手机CSS:
@media screen and (max-width: 768px) {
.body{ margin: 0px auto; width:250%; height:175%; padding:1%; }
#h1 {font-size:1.3em; }
#div2 ul li a {font-size:0.6em;}
#forum {font-size:0.8em; }
#form {font-size:0.6em;top : 125px;
float:right; }
#posts {font-size:0.6em;}
}
以下是他们适用于
的代码<body class = "body">
<div id = "div2">
<h1 id = "h1">Website</h1>
<ul>
<li><a href = "home.php"> Home </a></li>
<li class = "active"> <a href = "afe.php">webpage</a> </li>
<li> <a href = "ha.php">webpage</a> </li>
<li> <a href = "eaf.php">webpage</a></li>
<li> <a href = "list.php">list</a>
<ul>
<li> <a href = "af.php">webpage</a></li>
<li> <a href = "blah.php">webpage</a></li>
</ul>
</li>
<li> <a href = "try.php">webpage</a></li>
<li> <a href = "suggestions.php">Suggestions</a></li>
</ul>
</div>
<h1 class = "header"> What are you thinking about?</h1>
<form action='afe.php' class = "forum" method="post" enctype="multipart/form-data">
<textarea name="postbody" rows="4" cols="60" class = "text"></textarea>
<br />Upload an image:
<input type="file" name="postimg">
<input type="submit" name="post" value="Post">
</form>
这是搜索框
<div class = "form">
<form action="aef.php" method="post">
<input type="text" name="searchbox" value="" class = "form-search-input" placeholder="Search....">
<span><input type="submit" name="search" value=""></span>
</form>
</div>
</body>
这个网页是一个论坛,所以我可以在posts类中显示页面底部的所有帖子,而body类适用于整个网页。这里的页脚CSS不会出现在页面底部:.end {font-size:0.8em; bottom:0px;}