Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2010-05-25, 10:08 AM   #1
LD
wtfwjd?
 
LD's Avatar
 
Join Date: May 2007
Posts: 2,103
Question Centering div with HTML 4.01 Transitional

To center divs on a page, I usually use:
Code:
margin-right: auto;
margin-left: auto;
but this seems to only with HTML 1.0 transitional. Can you make it work with 4, or maybe just use 1.0 all the time or maye something else altogether....?
__________________
Artisteer Wordpress Theme Generator Create Custom Themes!
My Little Network
LD is offline   Reply With Quote
Old 2010-05-25, 10:17 AM   #2
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
I had a problem centering iframes recently using the code you posted. The solution was to give the item I was trying to center a fixed width instead of a percentage.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2010-05-25, 11:40 AM   #3
LD
wtfwjd?
 
LD's Avatar
 
Join Date: May 2007
Posts: 2,103
Quote:
Originally Posted by Cleo View Post
I had a problem centering iframes recently using the code you posted. The solution was to give the item I was trying to center a fixed width instead of a percentage.
iframes behave in strange ways sometimes for me, and I also do a fixed width usually wider than the iframe and add this:
Code:
text-align: center;
to the div's properties.

But I was referring to centering the actual div, not the content within the div. Seems to behave differently in HTML 1.0 and HTML 4.0
__________________
Artisteer Wordpress Theme Generator Create Custom Themes!
My Little Network
LD is offline   Reply With Quote
Old 2010-05-25, 11:47 AM   #4
bluebrit
Along for the ride and loving it.
 
Join Date: Aug 2005
Location: Canada
Posts: 1,873
the <center> tag was deprecated in HTML 4.0 so try using this
<div style="text-align: center;">
bluebrit is offline   Reply With Quote
Old 2010-05-25, 11:51 AM   #5
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Yeah it was the content within the div that I was talking about.

Despite using text-align: center; my iframe still wasn't centering. I did some Googling and found the suggestion to give my iframe a fixed width instead of a percent and it fixed it.

I still struggle with css but thought that maybe it would work with your issue too.

Just a guess but maybe
display:block;
margin-right:auto;
margin-left:auto;
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2010-05-25, 11:56 AM   #6
Nymph
Get me!
 
Nymph's Avatar
 
Join Date: Jan 2009
Location: Lower Alabama-The Redneck Riviera
Posts: 677
Send a message via ICQ to Nymph Send a message via Yahoo to Nymph
using
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

I use
<div align="center"></div>

of course you can use styling to the div tag too
Nymph is offline   Reply With Quote
Old 2010-05-26, 01:01 PM   #7
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
Quote:
Originally Posted by bluebrit View Post
the <center> tag was deprecated in HTML 4.0 so try using this
<div style="text-align: center;">
It was? I can still validate pages at w3.org using it.
link

http://slut-fest.com/gay-twinks-fuck/
Maj. Stress is offline   Reply With Quote
Old 2010-05-26, 03:32 PM   #8
bluebrit
Along for the ride and loving it.
 
Join Date: Aug 2005
Location: Canada
Posts: 1,873
Quote:
Originally Posted by Maj. Stress View Post
It was? I can still validate pages at w3.org using it.
link
It has been deprecated in 4.01 transitional and frameset, take a look at the table in their own link below.

http://www.w3schools.com/tags/default.asp
bluebrit is offline   Reply With Quote
Old 2010-05-26, 09:43 PM   #9
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
Quote:
Originally Posted by bluebrit View Post
It has been deprecated in 4.01 transitional and frameset, take a look at the table in their own link below.

http://www.w3schools.com/tags/default.asp
Interesting that the validator does not flag it. I've had it flag the div align="center" before.
Maj. Stress is offline   Reply With Quote
Old 2010-05-26, 09:46 PM   #10
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
Quote:
Originally Posted by Cleo View Post
Yeah it was the content within the div that I was talking about.

Despite using text-align: center; my iframe still wasn't centering. I did some Googling and found the suggestion to give my iframe a fixed width instead of a percent and it fixed it.

I still struggle with css but thought that maybe it would work with your issue too.

Just a guess but maybe
display:block;
margin-right:auto;
margin-left:auto;
I haven't tested it but that looks like it should work.
Maj. Stress is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:33 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc