Jump to content


This topic is now archived and is closed to further replies.


justify???? why wont it work, any help please

Recommended Posts

Hi everyone.

I'm trying to text out of my database and diplay it. Simple? or so it would seam.

I can display the txt in the right position but i can not get it to justify!
Has anyone else had this problem?
I've tryed the 'justify tag inside both the TD and a DIV, none seam to work.
left, center and right all work fine, but i really need it to be justify.

Any help please.

Heres the code

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <td width="202" class="title2"><div align="justify"><?php echo $row['title']; ?></div></td>
                        <td rowspan="2">&nbsp;</td>
                        <td width="202" rowspan="2" valign="top">

<table width="184"  border="0" cellspacing="0" cellpadding="0">
                              <td align="center"><img src="JPG/photos/ying-yang.jpg" width="183" height="183"></td>
<div align="justify"><?php echo $row['col2']; ?></div>

                        <td width="4" rowspan="2">&nbsp;</td>
                       <td width="202" valign="top"><div align="justify"><?php echo $row['col1']; ?></div></td>

Thanks  ???

Share this post

Link to post
Share on other sites
To justify text you'll have to use the style text-align with the attribute justify.
You can accomplish this in the HTML tag:
<div style="text-align:justify">.. your text here </div>
You can also create an entry in the heading of your page or in a separate CSS file:
<style type="text/css">
DIV.block {text-align:justify}
... your other stiles here

With this code you create a class block that can be used by the tag <div>
<div class="block">.. your text here </div> will have the same effect as <div style="text-align:justify">.. your text here </div>

Share this post

Link to post
Share on other sites
Hi, thanks for your help.

but its still not working?

<div style="text-align:justify"><?php echo $row['title']; ?></div>


<div class="block"><?php echo $row['col2']; ?></div>

any other ideas please?  :D

Share this post

Link to post
Share on other sites
This is more of an HTML issue, so if you can post the HTML output of the script rather then the PHP code.

like <div>text and more text</div>

for the text to be justified, it has to be longer then one line (with no line breaks <br />) or it will look normal

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.