我遇到了以下问题:<div class='navbar_item navbar_item_active font_colaboratelight' id='nav_".$navbarlink_id."_active' style='float:left;color:#ffffff;'>
浮动里面的元素很好......我一直在尝试一切,但我解决这个问题的唯一方法是在浮动元素上设置宽度,这是非常不切实际的,因为我不知道它们的内容...... .
有想法该怎么解决这个吗?
echo "<div style='width:960px;height:37px;margin-left:auto;margin-right:auto;'>
<div style='height:37px;background:url(/system/images/navbar/background/1.png);position:absolute;left:0px;right:0px;z-index:-1;'></div>
<div id='navbar_content' style='line-height:0px;width:960px;'>";
// get navbar shortcuts
$links = frontend_getnavbarlinks("sid_".$shop_id,$lang);
foreach($links as &$link){
$navbarlink_id = $link['id'];
$link_section_arr = explode(':',$link['section']);
$sectionlink_type = $link_section_arr[0];
$sectionlink_id = $link_section_arr[1];
if($link_section_arr[0] == 'c'){
$href = "/catalog/".$sectionlink_id."/";
}
echo "
<a href='".$href."' class='toggle_reconstruct'>
<div class='navbar_item navbar_item_active font_colaboratelight' id='nav_".$navbarlink_id."_active' style='float:left;color:#ffffff;'>
<div style='float:left;'><img src='/system/images/navbar/background_active/1_left.png'></div>
<div style='float:left;background:url(/system/images/navbar/background_active/1_middle.png);background-repeat:repeat-x;height:37px;'>
<div style='float:left;color:#E46F7B;font-size:15px;margin-right:6px;margin-left:6px;margin-top:12px;'>".$link['info']['label']."</div>
</div>
<div style='float:left;'><img src='/system/images/navbar/background_active/1_right.png'></div>
<div style='clear:both;'></div>
</div>
<div class='navbar_item navbar_item_inactive font_colaboratelight nav_btn_".$sectionlink_type.$sectionlink_id."' id='nav_".$navbarlink_id."_inactive' style='float:left;color:#ffffff;'>
<input type='text' value='".$link['does_expand']."' class='nav_expand_indicator' style='display:none;'>
<input type='text' value='".$navbarlink_id."' class='nav_section_id' style='display:none;'>
<input type='text' value='".$sectionlink_id."' class='nav_sectionlink_id' style='display:none;'>
<div style='padding-left:10px;padding-right:10px;height:37px;'>
<div style='float:left;color:#ffffff;font-size:15px;margin-right:6px;margin-left:6px;margin-top:12px;'>".$link['info']['label']."</div>
</div>
</div>
</a>
";
}
echo "
<div style='clear:both;'></div>
</div>
</div>
<div style='clear:both;'></div>
<div id='navbar_expand1'></div>";