M
M
mrzgt2015-08-20 13:55:35
css
mrzgt, 2015-08-20 13:55:35

How to make the menu not climb off the screen?

There is a menu, but at a lower resolution, the drop-down menu climbs off the screen
6d339aee03af48d4b3e8e761e27d14cc.png

<nav id="menu" class="navbar">
    <div class="navbar-header"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav">
    	<li class="home"><a href="<?php echo $home; ?>"><i class="fa fa-home"></i></a></li>
        <?php foreach ($categories as $category) { ?>
        <?php if ($category['children']) { ?>
        <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?><i class="fa fa-angle-down" style="color: red; font-size: 18px; left:10px; position: relative;"></i></a>
          <div class="dropdown-menu">
            <div class="dropdown-inner">
              <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
              <ul class="list-unstyled">
                <?php foreach ($children as $child) { ?>

         					<?php if (isset($child['children_lv3']) && $child['children_lv3']) { ?>
                		<li><img style=" display: block; margin: auto;" src="<?php echo $child['image2']; ?>" alt="" /><a style="text-align: center;" href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
                       
              						<?php foreach (array_chunk($child['children_lv3'], ceil(count($child['children_lv3']) / $child['column'])) as $children_lv3) { ?>
              							<ul class="list-unstyled">
                							<?php foreach ($children_lv3 as $child_lv3) { ?>
                                            	<li><a style="text-align: center;" href="<?php echo $child_lv3['href']; ?>">&nbsp;&nbsp;-<?php echo $child_lv3['name']; ?></a></li>
                        					<?php } ?>
                                       	</ul>
                                 	<?php } ?>
                        </li>
                   	<?php } else { ?>
                   <li><img style="display: block; margin: auto;" src="<?php echo $child['image2']; ?> " alt="" /><a style="text-align: center;" href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
                  	<?php } ?>
                <?php } ?>
              </ul>
              <?php } ?>  
      </div>
            <a href="<?php echo $category['href']; ?>" class="see-all"><?php echo $text_all; ?> <?php echo $category['name']; ?></a> </div>
        </li>
        <?php } else { ?>
        <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } ?>
        <?php } ?>
      </ul>
    </div>
  </nav>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deeppines, 2015-08-30
@LucasKane

The width is set in pixels most likely. Change it to a percentage and set the li tag to float: left. You may have to adjust the display through media

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question