Old 18-04-2007, 09:35   #1 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 485
Table falling out of div

Hi there,

I've been producing an application with PHP, and have used CSS for the styling. I had a form, and to make it look a little better (aligned) I have used a table.

First of all, I hope this isn't a bad thing to do. I know tables should only be used for tabular data.

Also, since I've put the form into a table, and its jumped out of the div (see picture) that its supposed to be inside. No idea why as it was fine when it was just the form on its own.



Any ideas?

Thanks
  Reply With Quote
Old 18-04-2007, 09:41   #2 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,902
<div style="clear:both"></div>

put that after the table
  Reply With Quote
Old 18-04-2007, 09:54   #3 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 485
Top man!

Cheers
  Reply With Quote
Old 18-04-2007, 10:04   #4 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,902
as you start working on more complex layouts you'll find the clear:both style quite useful. Best thing is to create a class called ".clearer" and just reuse as needed.

I find that in most sites I do I have to put a .clearer div at the bottom of the wrapper div in order to make the container stretch beyond the last element. I've never looked into the reason behind why it does it, as I just found it to work. I assume it's something to do with not defining a height for a div that has nested divs inside of it so it just assumes the height is the height of the content contained within that first div, so for example:

Code:
<div> I am some content and the height of my parent div will be the same height as me <div>I'm nested content and my height isnt taken into account</div> <div class="clearer"></div> </div>

so you add the clearer div to force the first div to take into account the nested contents height... clear as mud
  Reply With Quote
Old 18-04-2007, 10:13   #5 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,130
__________________
George Smith - a vain attempt to get higher on google for my name

  Reply With Quote
Old 18-04-2007, 10:14   #6 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,902
well thats handy, cheers sticky

on a side note, why is that blokes head in a toilet
  Reply With Quote
Old 18-04-2007, 10:19   #7 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,902
actually, just noticed for the first time that hes got a meat cleaver in his head and hes being served as dinner... for the past umpteen months ive glanced at that pic and seen it as a man with his head coming out of a toilet bowl.. dont ask!
  Reply With Quote
Old 18-04-2007, 11:22   #8 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 485
Thanks for the words of advice. Its little pieces like this that can really make a difference.

God knows I'm finding it hard enough learning new things whilst trying to pass a University degree course, in which they like to teach at least 40% bollocks and nonsense.
  Reply With Quote
Old 18-04-2007, 12:56   #9 (permalink)
longisland6
stephen eighmey
 
Join Date: Oct 2006
Location: earth
Posts: 152
there is a very nice article on alistapart.com about styling forms with css. even though you've solved your problem it's nice to know it's there...just use their search form.
  Reply With Quote
Old 18-04-2007, 14:52   #10 (permalink)
LorEye
amateur
 
LorEye's Avatar
 
Join Date: Apr 2006
Location: Nova Scotia
Posts: 99
Send a message via MSN to LorEye
just have to say... love the running dinosaur!
  Reply With Quote
Old 18-04-2007, 15:53   #11 (permalink)
stealthcow
knocking heads
 
stealthcow's Avatar
 
Join Date: Jul 2003
Location: London, UK
Posts: 1,902
thats the main reason i left uni early, the lecturers didnt know squat
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8