http://stackoverflow.com/questions/10487292/position-absolute-but-relative-to-parent
Hey, so, please check link above. There is first resolving answer, which was resolving my problem. But now I have problem, that DIV isn't displaying well when it is set to position: relative and position: fixed does work correctly. DIV itself has no children, first I am trying to get parent there, I will care about children later.

#div {
    position: relative;
    left: 0;
    top: 0;
    width: 15%;
    height: 100%;
    background-color: rgba(0, 0, 0, 1);
}

There appeears black line in top left, it is 15% width and hmmm, 0,8% high? It looks like it has no height set, but it does.
If I change position: relative to position: fixed (what is actually what I need) it works.

height of an relative positoned element in % is caclulated on the basis of its parents. You need to set height of parent. In case parent is body you can add following css to make your dive work:-

html,body{height: 100%;}

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.