[英]HTML / CSS / jQuery- Make inline-block divs fully cover their containing div, in spite of their container being contained by a smaller div
我试图使菜单内的一些图标向右溢出,并在用户向右拖动菜单手柄时显示出来。 问题在于,内联块div不想覆盖其容器的整个空间,因为轮流将其容器包含在较小的div中(这似乎限制了图标向右移动的距离)。
在图像中,以蓝色突出显示的div(通过chrome dev工具)是图标的容器。 由于某些原因,这些行不会达到其全部宽度,而是保持凝缩在左侧,由菜单div分隔。
我希望这不是很令人困惑。 有人可以帮我吗? 如何使图标完全占据其容器的宽度? 非常感谢!
码:
图标的css,由jQuery设置
$("." + localIcons[iconToRender].name).css({
"display": 'inline-block',
"width": box_width,
"height": box_height,
"border-radius": '5px',
"margin": box_margin / 2
});
图标容器:
// appended to the body: <div class="box-menu"> <div class="box-menu-icon-container"> </div> </div>
$( ".box-menu").css({
"position": 'absolute',
//Remember that the width of the menu is set by dragging the jQuery handle, so here I just set a minimum width equal to the size of the handle
"width": box_menu_handle_width,
"min-width": box_menu_handle_width,
"max-width": box_menu_max_width,
"height": box_menu_height,
"left": 0,
"top": '50%',
"margin-top": -( box_menu_height / 2 ),
"background-color": box_menu_color,
"border-radius": '0px 5px 5px 0px',
"overflow": 'hidden'
});
$(".box-menu-icon-container").css({
"height": box_menu_height - 60,
"width": box_menu_max_width
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.