2016-08-30 73 views
0

我想获得一个div,其中包含一组工具responsive.I有一个下面的菜单,我已作出响应。有人能让我知道这是错的吗?使div响应

#tools { 
 
    width: 160px; 
 
    position: fixed; 
 
    display: inline-block; 
 
    margin: 0 auto; 
 
    line-height: 1.4em; 
 
} 
 
@media only screen and (max-width: 600px) { 
 
    #tools { 
 
    width: 70%; 
 
    } 
 
}
<div id="tools" style="width: 100%"> 
 
    <table> 
 
    <tr> 
 
     <td> 
 
     <input type="text" id="searchInput" placeholder="Type To Filter" ng-model="search" class="searchMenu"> 
 
     </td> 
 
     <td id=uploadedit> 
 
     <button id="upload" onclick="insertIntoDatabase()" class="pinColor"><i class="fa fa-upload fa-2"></i> 
 
     </button> 
 
     </td> 
 
     <td id=impledit> 
 
     <button id="implview" onclick="openImplView()" class="pinColor"><i class="fa fa-pencil fa-2"></i> 
 
     </button> 
 
     </td> 
 
     <td> 
 
     <button id="home" class="homeButton"><i class="fa fa-home fa-2"></i> 
 
     </button> 
 
     </td> 
 
     <td> 
 
     <button id="keep-menu-open" class="pinColor" ng-click="openAndFixMenu"><i class="pinColor"></i> 
 
     </button> 
 
     </td> 
 
     <td> 
 
     <button id="open-left" class="toggleButton" ng-click="toggleMenu()"> <i class="fa fa-bars fa-2"></i> 
 
     </button> 
 
     </td> 
 
    </tr> 
 
    </table> 
 
</div>

This is the div when the browser is maximized

The second image is the div after changing the browser size

+1

也许在你的@media查询中摆脱了你的额外#号,所以你实际上是以#tools为目标的。 – rsn

回答

2

你在你的媒体查询有一个错字:它应该是#而不是##。除此之外,你声明width: 100%内联,它覆盖了你在样式表中写的任何内容,这就是为什么你看不到查询结果。

+0

加入##我不好。我确实删除了其中一个,但这些更改尚未响应。 – SNT

+0

我在回答中提到的“宽度:100%”如何? –

+0

这实际上改变了调整浏览器大小的div的大小。猜猜我调整工具大小的想法是错误的。即使在div大小发生变化之后,它也不会调整其中存在的工具的大小。 – SNT

1

也许最好采取风格= “100%”,从DIV,任何内嵌样式类似这样的意志战胜骑无论是在样式表。

另外,在媒体查询你有

##tools { width: 70%; } 

变化

#tools { width: 70%; }