|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
css align center
I know about text-align:center, but this doesn't seem to work on tables, images, etc, and float only works for right and left. is there another property that I can use to get them floating in the middle, without the guessing on margins?
|
|
#2
|
|||
|
|||
|
RE: css align center
haha... I had trouble with this forever... and here is how it should be done... I'll write you a nice little tutorial.
First of all, if you want your whole page at the center, put it all in a div or a table or some container housing it all. Once that is done, you need to understand two css concepts... absolute positioning and margins. Now you may think you know these but you really dont. First of all, you can set an absolute position to not only pixels, but percent. Now assuming you know how to do css positioning, set the container element to be 50% from the left of the page {position: absolute; left: 50%;} Now the top left corner of the element is in the exact middle of the page, but that does you know good at all does it. well, now comes part 2, you know that margin: tag in css... well it can be set to a negative value. So set the left margin to be negative half of the container width. So for example it the div tag is 700px wide, go like this {margin-left: -350px;} Congratulations, you're page should now be perefectly centered in a completely standards compliant fashion. |
|
#3
|
|||
|
|||
|
RE: css align center
lol, i dont know why i couldnt think of margins. Thanks a lot though, i would have been stuck on this forever.
|
|
#4
|
|||
|
|||
|
RE: css align center
thx a lot you saved my life
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > css align center |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|