-2

I have 2 div:

<div class="parent">
  <div class="child">
  </div>
</div>


<p>content after parent</p>

parent width is fix: 60em

chlid should be as wide as the screen

if i set child's css like below the parent does not take the child's height and the content after parent slides up.

position:absolute;
width:100%;
left:0;

Is there any way in css to solve this problem or should i use js?

Sylord
  • 1
  • 2
  • Your problem lies on the `absolute` positioning. Also, your examples are not displaying anything. – emerson.marini Apr 28 '15 at 15:00
  • possible duplicate of [Make absolute positioned div expand parent div height](http://stackoverflow.com/questions/12070759/make-absolute-positioned-div-expand-parent-div-height) – Paulie_D Apr 28 '15 at 15:32

1 Answers1

0

you say that "parent width is fix: 60em" if you mean the parent is fixed position and the child is absolute position then there is your problem. remove the absolute position of the child and position the parent how you want it.

ironmike
  • 143
  • 2
  • 13