[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

How do I center this text with css?

I have this bit of text:

<td class="component text label readonly "><label id="LABELID_VAR10" class="hidden" for="VAR10"></label></td><td class="control left">
<div>
<p id="VAR10"><font size="2">Please select the <b>Building</b> and enter the <b>Office</b> and <b>Phone Extension</b> for each person below.</font></p>
<label class="hidden" for="VAR10"></label><input name="VAR10" value="&lt;font size=&quot;2&quot;&gt;Please select the &lt;b&gt;Building&lt;/b&gt; and enter the &lt;b&gt;Office&lt;/b&gt; and &lt;b&gt;Phone Extension&lt;/b&gt; for each person below.&lt;/font&gt;" type="hidden">
</div>
</td>
I need to center the "Please select the..: section
That I need to center on the page.

Any help would be most appreciated
0
Donnie Walker
Asked:
Donnie Walker
1 Solution
 
LZ1Commented:
We need to see the rest of the table and any CSS accompanying. If the page is very large or complex, a live URL would be best.
0
 
grayeCommented:
Center what  ... the table?, the column?, the paragraph?, the input?
0
 
Donnie WalkerAuthor Commented:
I need to center this:

<td class="control left">
<div>
<p id="VAR10"><font size="2">Please select the <b>Building</b> and enter the <b>Office</b> and <b>Phone Extension</b> for each person below.</font></p>

No live url. This is on an intranet.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LZ1Commented:
You have 2 ways to do it depending on your situation:
1) give your <div> an id or class and then give it a width and margin:0 auto in  your CSS.
2) You could use align="center" on the td, however I would stay away from that since it's depreciated and not proper coding practice.

If your trying to center the text in the p#VAR10, then use text-align:center; in your CSS for that element.

There are 2 ways to center things in CSS:
1) Block level elements like divs, h tags, etc can be given a width and use margin:0 auto.
2)Text-align:center can be used for inline elements such as p, a and span tags.
0
 
haloexpertsexchangeCommented:
so add this to your css  #VAR10 { text-align:center}
0
 
Donnie WalkerAuthor Commented:
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now