Html 当调整窗口屏幕大小时,我们可以改变浮动值吗

Html 当调整窗口屏幕大小时,我们可以改变浮动值吗,html,css,css-float,Html,Css,Css Float,之前的浮点值是正确的,所以当我重新调整窗口屏幕的大小时,浮点值应该变成“无”。我该怎么做 <style> #test{ float:right; padding: 10px; color:"blue"; } </style> 然后,我尝试了这个代码,但它不工作 <style> @media all and (min-width: 450px){ float:none; } <style> 您忘记将css规则放在同一个测试类中 你忘了css选

之前的浮点值是正确的,所以当我重新调整窗口屏幕的大小时,浮点值应该变成“无”。我该怎么做

<style>
#test{
float:right;
padding: 10px;
color:"blue";

}
</style>
然后,我尝试了这个代码,但它不工作

<style>
@media all and (min-width: 450px){
 float:none;
}
<style>

您忘记将css规则放在同一个测试类中

你忘了css选择器

尝试:

试试这个

<style>
@media all and (max-width: 450px) {
  #test {
   float:none;
  }
}
<style>

首先,正如所有其他答案所指出的,你必须这样做:

@media all and (min-width: 450px){
    #test{float:none}
}
但您指出它不起作用,我猜您在媒体查询之后添加了测试的默认属性。您在媒体查询外部编写的选择器始终可用,并且它会覆盖您的属性。添加!重要的是,我们应该解决这个问题

@media all and (min-width: 450px){
    #test{float:none !important}
}
@media all and (min-width: 450px){
    #test{float:none}
}
@media all and (min-width: 450px){
    #test{float:none !important}
}