#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    13
    Rep Power
    0

    How to style hightlight_string and highlight_file with css


    Hello im in a but of a rut with this issue i have been trying all week to get this to work.

    i am using the php functions highlight_file and highlight_string but when my webpage returns the output the text is spread across the containers they are held in exceed the width of the website at times.

    i have tried doing this with a textarea to see if that makes any difference however it just displays pre code and span tags which i understand is the reason that the overlapping is happening

    i have tried manipluting these tags using css and had no luck as they css is still overwritten by the tags.

    can anyone help me with this issue and how i can style these to fit in a <div> container

    thanks in advances martin
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    Sydney Australia
    Posts
    183
    Rep Power
    83
    Originally Posted by mbamber1986

    i am using the php functions highlight_file and highlight_string

    Why do want to show anyone the contents of your php file?

    Do you REALLY want to do that? Check the php manual for your functions to see what they really do.
    http://au1.php.net/manual/en/function.highlight-file.php
  4. #3
  5. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,945
    Rep Power
    4033
    Assign a width and height to your div container, and give it the style overflow: auto;. That will cause it to have scrollbars if the contents exceeds the defined width and height
    Recycle your old CD's, don't just trash them



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    13
    Rep Power
    0

    its more highlight_string


    Originally Posted by BarryG
    Why do want to show anyone the contents of your php file?

    Do you REALLY want to do that? Check the php manual for your functions to see what they really do.
    http://au1.php.net/manual/en/function.highlight-file.php
    i dont want to use highlight_file its more string i want to use as i building a site in which users can upload their own scripts and also supply code snippets for users to copy and paste.

    these snippets would be held in a database and then returned using mysql_query(select);

    the problem is i cant style it ive triied strip_tags str_replace isnt work and preg_replace doesnt seem to help either

    any suggestions

IMN logo majestic logo threadwatch logo seochat tools logo