PDA

View Full Version : div not alinging inside div


upside_down
31st August 08, 12:26 PM
Ok, here's the code:

<style type="text/css">
div#maincontent {margin:0px}
p {margin: 0px; padding-left: 20px;}
</style>

<div id="maincontent">
<p>
blah blah blah

<div>text text text</div>

blah2 blah2 blah2
</p>
</div>

My issue is that the inside div is not horizontally aligning itself 20 pixels over with the rest of the text inside the <p> tag. Moreover, any text after the inside div (yet still inside the <p> tags) - i.e. blah2 - also doesnt adhere to the padding. My CSS is ok (well I thought so anyway) but this has serioulsy got me stumped (yes, I'm sure the answer is very simple, but I just cant work it out)

Please help...

George

ewwatson
31st August 08, 04:11 PM
Hi, you can't have a div inside a p :)

liam.smart
2nd September 08, 07:43 AM
I agree. Why not change it too:

<div id="maincontent">

<p>blah blah blah</p>

<p>text text text</p>

<p>blah2 blah2 blah2</p>

</div>

That will validate.