This is a discussion on "Headings floating left and right" within the Starting Out section. This forum, and the thread "Headings floating left and right are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Headings floating left and right
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Headings floating left and right
Hi!
I'm having a bit of trouble getting my floats to float in the right place. I have the following in HTML:
|
|
|
|
|||
|
Re: Headings floating left and right
Add a clear: both; to the h2!
|
|
|||
|
Re: Headings floating left and right
Wow thanks, that did the trick! Care to explain how that works or is it too complicated? Sometimes I get the feeling I may never understand these things, just code blind until something works
|
|
|||
|
Re: Headings floating left and right
Sure I'll see if I can explain it.
The float property moves an element left or right. (In your case.. right). In the process, content below the float will move up and wrap around the float. So the next thing under the float will fill in the empty space ON THE LEFT. If you put a clear: both; it's almost as if you have placed an imaginery line under the first float:right. The imaginery line fills up the entire width of the container, in this case headers. header ------------------------------ header If you float something to the left, it leaves empty space on the right. To stop a float you use clear. The clear property tells an element not to wrap around a floated item. By clearning you force the next element below. A clear left will drop below elements that are floated left but will still wrap around the right. A clear right will drop below elements that are floated right but will still wrap around the left. A clear both drops the element below both left and right floated elements. So technically you could use clear: right; but I told you clear: both; because I can never remember and I didn't want to take a chance! Totally confused now? EDIT: The words headers in the diagram should be moved over to the right but I can't make them move...darn.. Last edited by Lchad; Jul 21st, 2007 at 17:46. Reason: fix spacing of words header |
|
|||
|
Re: Headings floating left and right
By golly I think I actually understood most of that!
|
![]() |
| Tags |
| heading float |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Headings H1 & 2 appear too big on my web pages? | Oak | Web Page Design | 2 | Dec 26th, 2007 00:11 |
| Mozilla floating my div to the left and not Center | erikkl2000 | Web Page Design | 5 | Jan 5th, 2007 19:41 |
| Floating <hr>s to the left/IE problems... | escaflowne11 | Web Page Design | 5 | Oct 15th, 2006 21:34 |
| Floating Without tables | jcschott | Web Page Design | 3 | Apr 19th, 2005 16:22 |
| Table Column Headings and Page Breaks | Trebz | Web Page Design | 8 | Jun 4th, 2004 12:55 |