Page 1 of 2

i just want to center it ;(

Posted: Sun Sep 25, 2005 2:42 am
by s.dot
how can I center a <div> that doesn't have a width?
I don't want to provide a width because then my floating divs will break to the next line.

is this possible?

Posted: Sun Sep 25, 2005 3:10 am
by anjanesh
You want to center the <div> or the contents of the <div> ?

Posted: Sun Sep 25, 2005 3:12 am
by s.dot
I want to center the div

The contents of the div are text-align: left;

Posted: Sun Sep 25, 2005 3:13 am
by Ree
Try adding display: table to that div.

Posted: Sun Sep 25, 2005 3:26 am
by s.dot
display: table broke my float: left divs inside of the container div down to the next line

display: table-row works perfectly in firefox.. but looks the same in IE

any suggestions?

http://www.showmypro.com/showme2.php?u=scrotaye if you want to look. and look at source code.

Posted: Sun Sep 25, 2005 3:54 am
by anjanesh
Have you tried margin-left:auto;margin-right:auto; ?

Posted: Sun Sep 25, 2005 4:01 am
by s.dot
does nothing in IE.. in firefox it looks good.. using display: table-row; the margin didn't make a difference

Note to self: maybe i should go back to tables :-S

Posted: Sun Sep 25, 2005 9:15 am
by pilau
Have you tried

Code: Select all

<center>
   <div>
<!-- content -->
   </div>
</center>
?

Posted: Sun Sep 25, 2005 9:42 am
by s.dot
yes, that was one of the first things I tried :P

I really wanted the divs to be expandable in width.. but i guess I'll have to deal with fixed div widths until IE decides to come up to par ;)

Posted: Sun Sep 25, 2005 9:44 am
by Charles256
i came to the same conclusion ... :( i feel your pain so don't feel alone there buddy.

Posted: Sun Sep 25, 2005 10:17 am
by pilau
I don't know.. center works for me.

If you're generating it through PHP try and take a look at your HTML source code for debugging.

Posted: Sun Sep 25, 2005 10:46 am
by s.dot
the HTML is fine. the display: table-row; along with center worked fine in Opera, and FireFox, however IE doesn't recognize the display attribute.. I guess..

And since IE is like 80+ percent of what everyone is using, i had to settle for what I didn't want :P

Posted: Sun Sep 25, 2005 11:17 am
by pilau
I tell you, in 3 years, counting on the IE 7 Beta version, that would be just the opposite: 20% for IE, and the rest is for the best 8)

Posted: Mon Sep 26, 2005 2:26 am
by s.dot
pilau wrote:I tell you, in 3 years, counting on the IE 7 Beta version, that would be just the opposite: 20% for IE, and the rest is for the best 8)
heh, not unless some other dominant platform (such as windows) came along. with IE coming with windows and being the default browser, i'd say at least 20 % of average computer users don't even know other browsers exist :P

Posted: Mon Sep 26, 2005 6:47 am
by pilau
O, all 'm going to say is - changes and regulations are things humans can get used to. :P