Centering Header Text

User 193638 Photo


Registered User
557 posts

I have a line of text in a string of HTML and I want the words to be centered on the page. I know the command to use but for the life of me I cannot get it placed in the string of code in the right place to make it work.
Can someone please help??

[[[<p style="color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]

I know I am supposed to use <CENTER> and </CENTER> but where?
User 38401 Photo


Senior Advisor
10,951 posts

That would be like this, the main thing to remember is to put it outside anything you want centered. In other words, always make sure to include starting and closing tags of the item you want to include in your centering. In the above case that would be the <p></p> tags that enclose your text. You should be able to do it like this:

[[[<CENTER><p style="color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p></CENTER>]]]

User 562592 Photo


Registered User
2,038 posts

Steven Alford wrote:
I have a line of text in a string of HTML and I want the words to be centered on the page. I know the command to use but for the life of me I cannot get it placed in the string of code in the right place to make it work.
Can someone please help??

[[[<p style="color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]

I know I am supposed to use <CENTER> and </CENTER> but where?


Greetings,

You don't use the old <center> tags. There are two ways you can do this, either use the text-align inline option or use margins/padding to push the heading where you want it.

Ex:


[[[<p style="margin-left:100px;" color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]

OR

[[[<p style="text-align:center;" color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]


Hope this helps.
The philosopher has not done philosophy until he has acted upon the mere conviction of his idea; for proof of the theory is in the act, not the idea.

My Web Development Company: http://www.innovatewebdevelopment.com (Created with Coffee Cup Software).

My Personal Website: http://www.EricSEnglish.com

User 38401 Photo


Senior Advisor
10,951 posts

What The Philosopher says is very true, there are better ways to do it if you want to delve into the more correct way of centering. I'm still stuck on the <center></center> tags myself too which I need to change at some point. Couldn't get the inline styling to work at all and when I asked the CC team the reply was the <center> tags so that's what I used. Thanks for that reminder Eric so I can remember to update mine also.
User 562592 Photo


Registered User
2,038 posts

No Problem.

Hope you all had a great holiday.
The philosopher has not done philosophy until he has acted upon the mere conviction of his idea; for proof of the theory is in the act, not the idea.

My Web Development Company: http://www.innovatewebdevelopment.com (Created with Coffee Cup Software).

My Personal Website: http://www.EricSEnglish.com

User 193638 Photo


Registered User
557 posts

OR


[[[<p style="text-align:center;" color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]




Seems to be something wrong with this code. The text is centered but it lost the color and the font size.
User 38401 Photo


Senior Advisor
10,951 posts

you have an extra quotation mark after the text-aline:center; part, just take that out and it should work then so it should be like this: Remove the bold quotation mark in the first line to make it look like the 2nd line:

[[[<p style="text-align:center;" color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]

[[[<p style="text-align:center; color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]
User 193638 Photo


Registered User
557 posts

Well that did not solve the problem either. I even deleted the quotation mark after The bold and that did nothing.

Your second line still looks exactly like the original, no changes.
User 562592 Photo


Registered User
2,038 posts

Hmm.

I just put this code in a cart of mine and it worked:


[[[<p style="margin-left:200px;">This is a test</p>]]]


Just add your additional styling options to it, and adjust the 200 to whatever you need.


The philosopher has not done philosophy until he has acted upon the mere conviction of his idea; for proof of the theory is in the act, not the idea.

My Web Development Company: http://www.innovatewebdevelopment.com (Created with Coffee Cup Software).

My Personal Website: http://www.EricSEnglish.com

User 193638 Photo


Registered User
557 posts

I used this code that you gave me Philosoph

[[[<p style="text-align:center;" color:#ff0000; font-size:18px; font-weight:bold;">Welcome to S & S Bonsai</p>]]]


But it does not work. the color is not there or the font size. Center is fine

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.