Topic: aligning div's within a div header |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: |
posted 11-24-2003 17:27
I have a header div, and 2 div's within it. I want the first to be aligned to the left side, and the right aligned to the right. Or, at least have an affect where it's like the first and second are in different <td> tags if I were using a table to lay this out. code: <div id="header"> and this style: code: #logo
|
Nervous Wreck (II) Inmate From: Minnesota |
posted 11-24-2003 17:39
This should work. It will float the first one to the left, set its width to 50% . Set the second one's margin-left to 50% and set its width to 50% and text-align to right. code: #logo
|
Nervous Wreck (II) Inmate From: |
posted 11-24-2003 18:25
just using float:left; on #logo almost works, but, the divs following the header div overlap it a bit. |
Maniac (V) Inmate From: Seoul, Korea |
posted 11-25-2003 01:52
Here's the CSS2 specs on inline formatting. Now if you can tell me exactly what all of that means, you win the prize. I understand it in principle, but those specs are confusing. |
Nervous Wreck (II) Inmate From: |
posted 11-28-2003 00:50
suho: The image (71 pixels high) was taller than the text. Some reason the #header div was only as tall as the text even though the image was taller... The only solution I could find was forcing the header div to have a height:71px; but it probably will cause problems if other content is taller... There must be a better way. code: #header
|
Bipolar (III) Inmate From: Brisbane |
posted 11-28-2003 02:03
Setting a block level element like a DIV to display inline does absoluty nothing -- well, nothing productive anways. code: .headeraddress{float:right;}
code: #header{float:right;} /* Or text-align:right; */
|
Maniac (V) Inmate From: Seoul, Korea |
posted 11-28-2003 03:24
^What he said. Especially the part about using as little markup as possible. I should have thought of that, but I was too focused on the question. |
Nervous Wreck (II) Inmate From: |
posted 11-28-2003 15:53
quote: *hits self for forgetting* |