ton1
ton1

Reputation: 7628

CSS min-height of div that has position:relative

How can I extend div that has position:relative automatically? Should I use jQuery? It is okay, Please Help me!

I made a fiddle. If you see that, you can understand easily what I intend to.

https://jsfiddle.net/bexoss/roacL7o1/

Upvotes: 0

Views: 1451

Answers (1)

M.S.
M.S.

Reputation: 1091

Here is a correction:

.div1 { 
    position:relative;
    min-height:100px; 
    background-color:#ddd;
} 
.div2 { 
    position:relative; 
    left:0; background-color:red; 
    width:200px; 
    display:inline-block
}
.div3 { 
    position:relative; 
    left:250px; 
    background-color:yellow;
    width:200px; 
    display:inline-block; 
    vertical-align:top;
} 

The main issue was that when elements are positioned with absolute, they are not part of the normal document flow.

Upvotes: 1

Related Questions