Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Centering a Heading Inside a Division
Old 11-12-2009, 12:36 AM Centering a Heading Inside a Division
Junior Talker

Posts: 4
Name: Clint Watkins
Trades: 0
Hello!

I'm practicing design, and what I'm trying to do is center an h2 heading inside a division. I can't get it to work. My HTML reference book doesn't seem to have that information. (Of course, no book can tell you everything about anything. Hence the reason I'm practicing.) Thanks in advance for your help.
ClintWatkins is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-12-2009, 02:11 AM Re: Centering a Heading Inside a Division
Skilled Talker

Posts: 58
Trades: 0
In your stylesheet:

Code:
#YourDiv h2 
{
text-align:center
}
If not using external stylesheets:

Code:
<style type="text/css">

#YourDiv h2 
{
text-align:center
}
</style>
within the head tags.
whatsherface_21 is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 12:09 PM Re: Centering a Heading Inside a Division
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
<div align="center"></div> but I recommend the css style above
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 12:32 PM Re: Centering a Heading Inside a Division
frih's Avatar
Super Talker

Posts: 139
Name: abhi
Location: http://www.techbusy.org/
Trades: 0
The best way to make everything central, is to use <center> tag

<center>content</center>

You may also use CSS to do this, using the above code.
__________________

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
frih is offline
Reply With Quote
View Public Profile Visit frih's homepage!
 
Old 11-12-2009, 01:14 PM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
Yes, the center tag NEVER should have been depreciated.
marketingman100 is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 01:24 PM Re: Centering a Heading Inside a Division
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Did the calendar go back to 1999 and nobody told me???


there is NO NEED TO DO ANYTHING AT ALL to a heading element to make it "centred"

heading elements are BLOCK elements so occupy 100% width of the parent container.
so having text-align:center; on the heading will centre-align the text.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-12-2009, 01:41 PM Re: Centering a Heading Inside a Division
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
the center SHOULD be depreciated... imo it doesn't flow with css control and adds weight to coding...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 04:01 PM Re: Centering a Heading Inside a Division
blue-dreamer's Avatar
King Spam Talker

Posts: 1,222
Location: Middle England
Trades: 0
Quote:
Originally Posted by orionoreo View Post
the center SHOULD be depreciated...
It has been deprecated for years
blue-dreamer is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 07:34 PM Re: Centering a Heading Inside a Division
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
lol i meant deprecated oops
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Old 11-12-2009, 10:39 PM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
CSS is nothing but code bloat.
Simple things that used to happen with one small piece of code now take 5 lines of CSS to achieve the same code affect.

There was nothing more simple than center and tables.
Now we have to fight floating divs and margins to achieve the same thing.

This standards committee has been so far off logic for years its pathetic.
marketingman100 is offline
Reply With Quote
View Public Profile
 
Old 11-13-2009, 05:11 AM Re: Centering a Heading Inside a Division
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You're being a luddite again Doug

You don't HAVE to use it of course, we won't grass you up to the CSS police.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-13-2009, 08:48 AM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
New is not always better.
marketingman100 is offline
Reply With Quote
View Public Profile
 
Old 11-13-2009, 08:52 AM Re: Centering a Heading Inside a Division
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Ain't that a fact!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-13-2009, 02:53 PM Re: Centering a Heading Inside a Division
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
CSS is nothing but code bloat.
Simple things that used to happen with one small piece of code now take 5 lines of CSS to achieve the same code affect.
Oh, puuuhleeeeeeeeease.... lets do the time warp, shall we??
If it takes you 5 lines of CSS to center an HX element, then you don't know what you're doing
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-13-2009, 04:08 PM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
<Center>
vs
<Div align:center; margin:0; fullmoon:off; microsoftie:noexplode; set warning message:on; holdbreath:on;hope it works:on;>

Last edited by chrishirst; 11-13-2009 at 04:10 PM.. Reason: smilies turned off
marketingman100 is offline
Reply With Quote
View Public Profile
 
Old 11-14-2009, 09:03 AM Re: Centering a Heading Inside a Division
Junior Talker

Posts: 4
Name: Clint Watkins
Trades: 0
Thanks for all the help. I realized my mistake. After working with it for a while, I realized the previous division had not properly been defined. I put an absolute position in the CSS and then it worked. Thanks again for helping the newbie.
ClintWatkins is offline
Reply With Quote
View Public Profile
 
Old 11-14-2009, 11:39 AM Re: Centering a Heading Inside a Division
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Actually, there is much less "code bloat" with CSS methods, because it only needs to be linked to once. The larger your site, the more noticeable this difference is and the faster it becomes to develop the site as time goes on.

Never save five minutes now when you can save an hour in the future.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 11-14-2009, 11:56 AM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
You coding junkies make me laugh. Iwhipped out a table variation for someone last night in about 10 minutes and it would have taken an hour to figure out how to make divs do the same thing and then hope that they didn't crash out in Internet Exploder.

Three column table layout:

<Table> <TR><TD></TD><TD></TD><TD></TD></TABLE>

Same effect with Divs would take far more code.
Plus all the IE correction code to make sure it doesn't crash.

Plus the fact that CSS will be a passing fad soon with the introduction of HTML 5,6,7,8.

Plus the whold new code set to facilitate 64 and 128 bit architectures and abilities.

HTML should been expanded, not abandoned.
marketingman100 is offline
Reply With Quote
View Public Profile
 
Old 11-14-2009, 12:17 PM Re: Centering a Heading Inside a Division
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It is missing a </tr> btw.

Actually that would be better done using <span>s not <div>s

<div><span></span><span></span><span></span></div>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-14-2009, 02:45 PM Re: Centering a Heading Inside a Division
Banned

Posts: 315
Name: Doug
Trades: 1
</TR>

It was hiding under my keyboard......

Last edited by marketingman100; 11-14-2009 at 02:47 PM..
marketingman100 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Centering a Heading Inside a Division

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.25237 seconds with 12 queries