I have 2 divs:
How can I position the "insdie" div in the "all" div, at the following way:PHP Code:<div id="all">
<div id="inside"></div>
</div>
(it means 20px up from the bottom of the "all" div)?
I have 2 divs:
How can I position the "insdie" div in the "all" div, at the following way:PHP Code:<div id="all">
<div id="inside"></div>
</div>
(it means 20px up from the bottom of the "all" div)?
Like:
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #all { font : italic 150% sans-serif; border : 1px solid #000; width : 200px; padding-bottom : 20px; } #all p, #inside p { margin : 0 0 2em 1ex; } #inside { font : italic 100% sans-serif; border : 1px solid #000; margin : 0 0.25ex; } </style> </head> <body> <div id="all"> <p>all</p> <div id="inside"><p>inside</p></div> </div> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
lord22 (07-26-2008)
HAHA REALLY NICE
Thank you very much !
But actually it's not what I'm looking for, my "all" div can change his height that can be 300px or more, and the inside div should be always stay only 20px up from the bottom no matter what.
Last edited by lord22; 07-26-2008 at 05:11 AM.
This rule (highlighted):
will always make a 20px gap after the #inside division in the layout, regardless of the height of #all, as long as #inside is the last thing in #all. But let's say that #all has text in it after #inside. Then we can do (after removing theCode:#all { font : italic 150% sans-serif; border : 1px solid #000; width : 200px;padding-bottom : 20px;}padding-bottom : 20px;rule from #all):
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #all { font : italic 150% sans-serif; border : 1px solid #000; width:200px; } #all p, #inside p { margin : 0 0 2em 1ex; } #inside { font : italic 100% sans-serif; border : 1px solid #000;margin : 0 0.25ex 20px 0.25ex;} </style> </head> <body> <div id="all"> <p>all</p> <div id="inside"><p>inside</p></div> more text here that's in all. </div> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Hi, I understand what you are saying but my problem is that the height of the "all div" height is changing in every page, no matter what it has in.
it can be like:
----------------------------
text
inside
{20px}
----------------------------
or:
----------------------------
text
text
text
inside
{20px}
----------------------------
I want that the "inside" div will always stay at the bottom of the div.
I know that it is easy to do with tables but I prefer using css.
The first solution I posted will work for that.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Watch, this is your code:
http://maspic.com/try.html
What am I doing wrong?
That's a mixture of the styles from my two examples. As I said before, for what you described here:
http://www.dynamicdrive.com/forums/s...91&postcount=5
The first solution will do the job:
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #all { font : italic 150% sans-serif; border : 1px solid #000; width : 200px; padding-bottom : 20px; } #all p, #inside p { margin : 0 0 2em 1ex; } #inside { font : italic 100% sans-serif; border : 1px solid #000;margin : 0 0.25ex;} </style> </head> <body> <div id="all"> <p>all</p> <div id="inside"><p>inside</p></div> </div> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
I very appreciate your willingness to help me.
I've also tried it, and again:
http://maspic.com/try2.html
Sorry, I misunderstood your followup question. I thought the varying height was due to the content of #all forcing #all to be taller, not you setting its style height property. There is a fairly easy way to take care of that, but it isn't cross browser. This is:
But it is a little complicated, if you don't follow what is happening, let me know what part you don't understand.Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #all { font : italic 150% sans-serif; border : 1px solid #000; width : 200px; height : 200px; position : relative; } #all p, #inside p { margin : 0 0 2em 1ex; } #inside { font : italic 100% sans-serif; border : 1px solid #000; margin : 0 3px; position : absolute; width : 192px; bottom : 20px; } </style> </head> <body> <div id="all"> <p>all</p> <div id="inside"><p>inside</p></div> </div> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
lord22 (07-26-2008)
Bookmarks