Y
Y
yoyoyoyoyoyoyoyoyoyoyoyoyo2021-04-28 15:16:50
css
yoyoyoyoyoyoyoyoyoyoyoyoyo, 2021-04-28 15:16:50

How to make a submenu the entire width of the container?

Good afternoon. Can you please tell me how to make a horizontal submenu the entire width of the container?

Tried to solve this problem with

.dropdown-menu {
  width: 100%;
  max-width: 1140px;
text-align: center;
left: 0%;
right: 0%;
top: auto;
position: fixed;
margin: 0 auto;
}

Looks like that. as it should, but because of the fixation, the menu suffers if it is slightly scrolled.

The submenu will have 4-5 columns.

I understand that it is necessary to work with this part of the code, but I have already tried everything ...
<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) { ?>
                <li class="drop-dva"><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
                <?php } ?>
              </ul>
              <?php } ?>
            </div>
             </div>


I do on a standard template ocstore 2.3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Il'ia Kartovitskii, 2021-04-28
@kartovitskii

First things first: left: 0% overlaps right: 0%, a redundant property.
Second, an example:

<!-- Условный родительский контейнер .container -->
<div class="container">
    <!-- Список с элементами меню ul -->
    <ul>
        <li>
            <a href="#">Ссылка 1</a>
        </li>
        <li>
            <a href="#">Ссылка 2</a>
        </li>
        <li>
            <a href="#">Ссылка 3</a>
        </li>
    </ul>
</div>

<style>
    .container ul {
        display: block;
        height: 60px;
        line-height: 60px;
        background: #ededed;
    }
    .container ul li {
        display: inline-block;
        list-style-type: none;
        padding: 0 20px;
    }
</style>

Third, your question seems to me to have very little input, so the answer is partly based on guesswork as to what is required.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question