Question: I have an issue making a fixed div the width of its parent element, which is itself defined relatively to another div. 

It may not be clear at first so here is a code which illustrates the situation:

**HTML** 

```
<div class="grandparent">
    <div class="parent">
        <div class="fixed"></div>
    </div>
</div>

```

**CSS**

```
.grandparent {
     width:100px;
     position:relative;
 }

.parent {
     width:70%;
     position:relative;
 }

.fixed {
     width:100%;
     position:fixed;   /* This div must be fixed and have 100% width relative to parent */
 }

```

Here is a [JSFiddle](https://jsfiddle.net/k0vndvzj/#&togetherjs=o1AKKJndhT).

Is there any way the .fixed div can inherit the width of its parent while having a fixed position?

Thank you.

Answer: 
Use `postion: absolute` instead of `position: fixed`.

Absolute positionning applies to the first relative parent.
Fixed applies to the window.

You can then place the div relatively to it's parent in the viewport with `top`, `left`, `right`, and `bottom` attributes.

Fiddle: <https://jsfiddle.net/k0vndvzj/3/>
`position: fixed` is relative to window viewport, just remove `position: fixed;` from `.fixed {...}` then you are fine