如何在重新调整大小时使它们不移动?

如何在重新调整大小时使它们不移动?

问题描述:

我希望我的网站能够全部分辨率友好,所以一切都以中心为中心,当我缩小窗口时,它全部向左移动并停止。不过,当我缩小窗口时,我的新闻Feed会降低到投票数以下。如何在重新调整大小时使它们不移动?

继承人的CSS代码:

#poll { 
float: left; 
margin: 0px 20px; 
} 

#newsfeed { 
float: right; 
margin: 0px 20px; 
} 

<div id="poll"> 
<form method="post" action="http://poll.pollcode.com/t78ar8"><table border=0 width="244" bgcolor="EEEEEE" cellspacing="2" cellpadding="0"><tr><td colspan="2" height="10"><font face="Tahoma" size="2" color="000000"><b>What game site do you visit most?</b></font></td></tr><tr><td width="5"><input type="radio" name="answer" value="1" id="t78ar8answer1"></td><td>&nbsp;<font face="Tahoma" size="2" color="000000"><label for="t78ar8answer1">Ign</label></font></td></tr><tr><td width="5"><input type="radio" name="answer" value="2" id="t78ar8answer2"></td><td>&nbsp;<font face="Tahoma" size="2" color="000000"><label for="t78ar8answer2">GameSpot</label></font></td></tr><tr><td width="5"><input type="radio" name="answer" value="3" id="t78ar8answer3"></td><td>&nbsp;<font face="Tahoma" size="2" color="000000"><label for="t78ar8answer3">GameFAQs</label></font></td></tr><tr><td width="5"><input type="radio" name="answer" value="4" id="t78ar8answer4"></td><td>&nbsp;<font face="Tahoma" size="2" color="000000"><label for="t78ar8answer4">GamerZone</label></font></td></tr><tr><td width="5"><input type="radio" name="answer" value="5" id="t78ar8answer5"></td><td>&nbsp;<font face="Tahoma" size="2" color="000000"><label for="t78ar8answer5">Mmohut</label></font></td></tr><tr><td colspan="2" height="10"><center><input type="submit" value=" Vote ">&nbsp;&nbsp;<input type="submit" name="view" value=" View "></center></td></tr></a>&nbsp;</font></td></tr></table></form> 

    </div> 
    <div id="newsfeed"> 
    <!-- start sw-rss-feed code --> 
    <script type="text/javascript"> 
    <!-- 
    rssfeed_url = new Array(); 
    rssfeed_url[0]="http://news.yahoo.com/rss/gaming"; 
    rssfeed_frame_width="500"; 
    rssfeed_frame_height="720"; 
    rssfeed_scroll="on"; 
    rssfeed_scroll_step="6"; 
    rssfeed_scroll_bar="on"; 
    rssfeed_target="_blank"; 
    rssfeed_font_size="14"; 
    rssfeed_font_face=""; 
    rssfeed_border="on"; 
    rssfeed_css_url="http://udel.edu/~ssell/newsfeed.css"; 
    rssfeed_title="on"; 
    rssfeed_title_name=""; 
    rssfeed_title_bgcolor="#3366ff"; 
    rssfeed_title_color="#fff"; 
    rssfeed_title_bgimage="http://"; 
    rssfeed_footer="off"; 
    rssfeed_footer_name="rss feed"; 
    rssfeed_footer_bgcolor="#fff"; 
    rssfeed_footer_color="#333"; 
    rssfeed_footer_bgimage="http://"; 
    rssfeed_item_title_length="50"; 
    rssfeed_item_title_color="#666"; 
    rssfeed_item_bgcolor="#fff"; 
    rssfeed_item_bgimage="http://"; 
    rssfeed_item_border_bottom="on"; 
    rssfeed_item_source_icon="off"; 
    rssfeed_item_date="off"; 
    rssfeed_item_description="on"; 
    rssfeed_item_description_length="120"; 
    rssfeed_item_description_color="#666"; 
    rssfeed_item_description_link_color="#333"; 
    rssfeed_item_description_tag="off"; 
    rssfeed_no_items="0"; 
    rssfeed_cache = "7872565d53aadc6c14b4ab1bb3f79bdb"; 
    //--> 
    </script> 
    <script type="text/javascript" src="rss-feed.js"></script> 
    <!-- end sw-rss-feed code --> 
    </div> 
+0

请提供html。 http://jsfiddle.net也可能是好的或者是有问题的项目的链接。 – Jrod 2013-03-06 14:29:44

+0

@Jrod感谢您的建议。为什么我的问题被拒绝了? – TheUnCola 2013-03-06 14:33:59

+0

最有可能是因为它缺乏html,但我不能肯定地说,因为我不是那个倒票的人。通过阅读http://stackoverflow.com/questions/how-to-ask,你将不会有任何问题。 – Jrod 2013-03-06 15:16:28

,如果你不想使用自适应设计或相近开关一个简单的解决方案:尝试 包装容器“#poll”和“#newsfeed”与另一个包含以下CSS的容器(#wrapper):

#wrapper { 
min-width:500px; /* 500px = max. sum of box model width values of #poll and #newsfeed" */ 
width: auto !important; /* IE>=7 */ 
width: 500px; /* IE<7 */ 
} 
+0

你能解释一下吗?我不明白响应式设计或类似开关是什么。 – TheUnCola 2013-03-06 15:55:54

+0

如果必须具有多个容器,并且在调整视口大小时不允许中断,则需要在块元素周围指定固定宽度的包装。 IE需要一点帮助。 “响应式设计或类似的开关”我的意思是代码,因为使用客户端javascript,条件注释或CSS媒体查询,在客户端呈现不同的代码。 – 2013-03-07 09:32:56

+0

我试过,但它没有工作 – TheUnCola 2013-03-08 03:20:27

给你的div容器一个最小宽度和最大宽度可能会解决这个问题。
确保您的投票&新闻源宽度与您的保证金相结合不超过您的容器的最小宽度。

例子:

HTML:

<div id="container"> 
<div id="poll"> </div> 
<div id="newsfeed"> </div> 
</div> 

CSS:

#container { 
max-width:1240px; 
min-width:600px; 
} 
#poll { 
float:right; 
max-width:620px 
min-width:280px; 
margin:0 20px; 
} 
#newsfeed { 
float:left; 
max-width:620px; 
min-width:280px; 
margin:0 20px; 
} 
+0

在较低分辨率下,新闻Feed仍低于投票率。 – TheUnCola 2013-03-06 18:45:36