JavaScript and client side scripting.
Moderator: General Moderators
thallish
Forum Commoner
Posts: 60 Joined: Wed Mar 02, 2005 11:38 am
Location: Aalborg, Denmark
Post
by thallish » Wed Apr 13, 2005 1:06 pm
hey all
I'm currently playing around with the idea of making my own box where source code is shown. I am using it for smaller code snippets.
The page is:
http://www.thallish.dk/php_mysql_connect.php
As you can see the text in the code box is not aligning left? And that annoys me big time!
my CSS code for that particular class is
Code: Select all
pre.code{
white-space: pre;
color: #000000;
background-color: #999999;
padding-right: 2px;
padding-left: 2px;
padding-bottom: 2px;
padding-top: 2px;
font: 8pt Courier, monospace;
width: 100%;
overflow: scroll;
overflow: auto;
}
Can anybody help me please? And if this is not the best way to do don't be afraid to say so
/thallish
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Wed Apr 13, 2005 2:20 pm
He he he... I wont laugh cos it's easily done
Look at your HTML source... the text is all indented and <pre> is therefore doing it's job very affectively
By the way... I think you should look into
highlight_string() and
highlight_file() ... this will make the job easier and PHP code look far prettier (like in this forum)
Code: Select all
$server = "e;hostname"e;; // the servername
$user = "e;root"e;; // username
$password = "e;password"e;; // server password
$database = "e;database"e;; // name of database
$db = mysql_connect($server, $user, $password) or die("e;Couldn't connect to database"e; . mysql_error());
$connection = mysql_select_db($database,$db) or die("e;Couldn't connect to database"e; . mysql_error());
thallish
Forum Commoner
Posts: 60 Joined: Wed Mar 02, 2005 11:38 am
Location: Aalborg, Denmark
Post
by thallish » Wed Apr 13, 2005 4:21 pm
hey
thank you for the reply
I finally got to the same conclusion as you with the whitespace by playing around a little. But thanks anyway. and i'll look in on the functions you posted
regards
thallish