Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Justifying text in a text box

Status
Not open for further replies.

qws

MIS
Jun 23, 2005
26
AU
Hello,

I have a text box on a html page where I want to be able to justify the text in the text box. No matter what I have tried it stays left aligned. Is anyone able to help?

If you want to see what I am talking about, the page is at
Any help would be much appreciated. (or if anyone has any alternative suggestions for creating a box on the page that can scroll and will be justified)

Thanks
 
Here's a sample CSS class:

Code:
.bodyText
{
  font-family: Verdana;
  font-size: 8pt;
  font-weight: normal;
  line-height: 12pt;
  text-align: justify;
}

And how to use it in your HTML:

Code:
<div>
<p class="bodyText">
This paragraph will be justified.
</p>
</div>

Of course, you should give the containing DIV it's own class, one that sets an appropriate width.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Hi there. Thanks for getting back to me! :)

I actually have a style linked to it already which has justify in it. The style class info is:

.scrolling-box {
font-family: Tahoma;
font-size: 12px;
background-color: #313131;
text-align: justify;
color: #959595;
float: none;
border: thin #999999;
margin-left: 7px;
}

In the actual web page istelf, the code that links to this is:

<textarea name="Australian Construction Supplies" cols="55" rows="10" readonly="readonly" class="scrolling-box">Welcome to Australian Construction Supplies.
We offer a complete range of products for both residential and commercial projects. </textarea>

Am am I missing something?
 
Hi Chris,

I didn't know you could do that. Are you able top point me through to any web pages that have examples of this?
 
Chris is right. Looks like you are using textarea for visual effect rather than its usage. You are much better off going with a div.
 
Thanks heaps! I haven't checked it out properly, but looks like such a simple solution! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top