SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast graphical_force's Avatar
    Join Date
    Sep 2008
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    style php output with css

    Hi, I am trying to style the output of my php with css.

    Here is the code:

    PHP Code:
    <?php
    srand 
    ((double)microtime()*1000000);
    $f_contents file ("list.txt");
    $line $f_contents[array_rand ($f_contents)];
    print
    $line;
    ?>
    It is reading a text file and randomly displaying a line but when I wrap it in a div to apply css, it does not work.

    Any ideas?

    Thanks in advance!

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2005
    Posts
    1,191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there is no html to style there

    <p class="random-line"><?php echo $line; ?></p>

    then style the paragraph

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by graphical_force View Post
    It is reading a text file and randomly displaying a line but when I wrap it in a div to apply css, it does not work.

    Any ideas?
    Forget about the PHP code, because it's not relevant.

    View the page in your browser, right click the page, and click "View Source". That's the HTML sent to the browser, that's what you need to target with your stylesheet.

  4. #4
    SitePoint Enthusiast graphical_force's Avatar
    Join Date
    Sep 2008
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My fault, I should have posted all of my code (html included)

    None the less, your help has solved my problem and I thank you!


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
  •