i just want to center it ;(

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

i just want to center it ;(

Post 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?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

You want to center the <div> or the contents of the <div> ?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I want to center the div

The contents of the div are text-align: left;
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Try adding display: table to that div.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Have you tried margin-left:auto;margin-right:auto; ?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

Have you tried

Code: Select all

<center>
   <div>
<!-- content -->
   </div>
</center>
?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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 ;)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

i came to the same conclusion ... :( i feel your pain so don't feel alone there buddy.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post 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)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

O, all 'm going to say is - changes and regulations are things humans can get used to. :P
Post Reply