A
A
alex_6432020-04-13 19:27:43
css
alex_643, 2020-04-13 19:27:43

How to fix an element and add overflow: hidden property?

There are two elements external and internal. It is necessary that the inner one had a property position: fixed;and the outer one, overflow: hidden;but as soon as I attach it position: fixed;to the inner one, it disappears overflow. How to save both properties?

5e9492f2d7ac1880220081.png

.outer{
  display: grid;
  height: 200px;
  width: 200px;
  border: 3px dashed;
  border-color: black;
  overflow: hidden;
}
.inner{
  position: fixed;
  height: 100px;
  width: 100px;
  margin: 100px 100px 100px 100px;
  border: 3px solid;
  border-color: black;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jupiter Max, 2020-04-13
@vardoLP

fixed cannot have a parent, it is always itself. Try replacing it with absolute

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question