Log in

View Full Version : styling external stlye sheet called by ajax routine



fodo
08-14-2008, 03:01 PM
I am trying to style an external css called by an ajax routine.
I have a simple page enclosed in a div that i want to style with a gray background. I also want an ul list.
The problem is I cant get the background to work in the div and nor the ul.
Any help appreciated.
The css code is

p.definition{
border:2px solid black;
text-align:left;
background-color:gray;
}
h2.definition{
font-weight:bold;
}
#definition {
background-color:gray;
}

the html mark up is

<div id="definition">
<h2 class="definition">Achieving Lift Off</h2>
<h2>Allan Wilson</h2>


<p class="definition">
"I'm stunned!.. This ebook is an aggregation of some of the most powerful marketing techniques being used on the Internet today not just by myself but other Internet Marketing Experts as well! Everything contained in this manual is enough to help anyone earn thousands per month on the internet. It's just up to you to do it. Highly recommended!"
<ul>
<li>mcmcmcmcm</li>
</ul>
</p>
</div>


</body>
</html>

fodo
08-14-2008, 04:13 PM
Ok, I have a background for the div.
Can anyone sugest how i can center the p element.
I should add that the page loads into a table cell.
css is now

p.definition{
border:2px solid black;
text-align:left;
background-color:gray;
margin:0 auto;
}
h2.definition{
font-weight:bold;
color:black;
}
#definition {
background-color:gray;
text-align:center;
color:black;

The ajax and table code is

//Display Book Image and add dynamic link to display full details details of the book from external file
//first page
echo '<table id="t5" width="600" align="center">';
echo '<tr>
<th bgcolor="#cccccc" align="center">Price</th><th class="right"align="center" bgcolor="#cccccc" colspan="2">Description</th><th align="center" bgcolor="#cccccc">Author</th><th align="center" bgcolor="#cccccc">Bookmark</th>
</tr>';

echo '<tr><td>';

echo number_format($book['price'], 2);
echo '</td>';
echo '<td class="t5" colspan="2">';
echo $book['product_desc'];
echo '</td>';
echo '<td class="t5">';
echo $book['author'];
echo '</td>';
echo '<td>';
display_bookmark("bookmark_list.php?product_id=$product_id", 'bookmark','add to browse list ');
echo '</td>';
echo '</tr>';


?>

<tr><td><a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');loadobjs('./includes/external.css');"><img src="<?php echo "./images/".$book['pix']; ?>" border='0' width='80' height='100'alt="View Book details"></a>
</td>
<td><a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');loadobjs('./includes/external.css');">View Book Contents</a></td>
<td align="center">
<div id="contentarea"></div>
</td>
<td><a href="javascript:ajaxpage('<?php echo $p3?>', 'contentarea');">Author Details</a></td></tr>

<!--Check for author bio. If available, display link. code in e-cart21 redundant?-->

</table>

Medyman
08-15-2008, 01:38 PM
If you want to center the content within the <p> tag, add text-align:center to it's style declaration. If you want to center the entire <p> block, add a explicit width to it's style declaration.

fodo
08-15-2008, 02:08 PM
Thanks very much.