V
V
vasIvas2015-11-03 12:41:31
css
vasIvas, 2015-11-03 12:41:31

How to position the dropdown list so that it does not go beyond the set aisles?

Jumping ahead a bit in my "css exercises" I want to know if it's possible to position a drop down menu with just css alone. Imagine there is a set width of 800px and the last menu item is pushed all the way to the right. And when I click on it, the dropdown goes beyond 800px. Can this be avoided with just css? And if so, please explain how.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Shabalin, 2015-11-03
@vasIvas

This is not recommended for css.
But if for the sake of experiment, you can change the positioning of the drop-down list through the last menu item.
Your drop down list looks like this. Well, i.e. "hooks" to the menu item on the top left.
css

.subList {
  ...
  position: absolute;
  top: 0;
  left: 0;
  ...
}

Here you need the last menu item to have the drop-down list "cling" to the right side.
css
.items:last-child {
  .subList {
    right: 0;
  }
}

Y
Yaroslav Lyzlov, 2015-11-03
@dixoNich

max-width:800px;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question