Advanced Search

Results 1 to 4 of 4

Thread: styling external stlye sheet called by ajax routine

  1. #1
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default styling external stlye sheet called by ajax routine

    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>

  2. #2
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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>


  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  4. #4
    Join Date
    Feb 2008
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks very much.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •