html - div float left bug in google chrome -
i`ve got structure of menu in html:
<div id="menu_box"> <a title="" class="menu_item_rfc" href="/main/menu/1"> <div class="menu_item"> bla bla bla </div> </a> <a title="" class="menu_item_rfc" href="/main/menu/2"> <div class="menu_item"> bla bla bla </div> </a> <a title="" class="menu_item_rfc" href="/main/menu/3"> <div class="menu_item"> bla bla bla </div> </a> <div id="search_box"> <form id="search_form" action="" method="post"> <div style="float:left;padding:4px 0 0 0;"> <input id="search" type="text" value="поиск товара" name="search"/> </div> <div style="float:left;padding:4px 0 0 0;"> <div id="search_btn"></div> </div> <div class="clear"></div> </form> </div> <div class="clear"></div> </div>
and css:
#menu_box { display: table; /*margin:20px auto;*/ width:715px; border:1px solid #efefef; -moz-border-radius-left:5px; -webkit-border-radius:5px; -khtml-border-radius:5px; border-radius:5px; margin: 23px 0 0 0; background-color:#efefef; float:right; } .menu_item { display: table-cell; float:left; margin:0; padding:7px 15px; height:18px; background-color:#fff; /* ie10 consumer preview */ background-image: -ms-linear-gradient(top, #ffffff 0%, #ddd 100%); /* mozilla firefox */ background-image: -moz-linear-gradient(top, #ffffff 0%, #ddd 100%); /* opera */ background-image: -o-linear-gradient(top, #ffffff 0%, #ddd 100%); /* webkit (safari/chrome 10) */ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #ffffff), color-stop(1, #ddd)); /* webkit (chrome 11+) */ background-image: -webkit-linear-gradient(top, #ffffff 0%, #ddd 100%); /* w3c markup, ie10 release preview */ background-image: linear-gradient(to bottom, #ffffff 0%, #ddd 100%); } #search_box { display: table-cell; float:left; height:32px; background-color:#fff; }
as u can see elements in menu_box floated left , menu_box fixed width.
the problem last div, if menu_item, drops down when resizing browser ctrl+, ctrl-, on ctrl0 dimensions ok. lot of users unconsciously use dims +-. problem appears in chrome, in ff, safari, ei ok. how can solve matter? may face problem. thx in advance.
example:
ps don't think anchor problem, mean anchor wrapping div menu_item.
seems it's due way browser calculating box.
read box model, , using border-box. should solve problem.
if not, i'd have see code. perhaps upload jsfiddle?
Comments
Post a Comment