HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Display and format text from .txt file.
Post new topic   Reply to topic    HTML Help Forum -> General HTML
View previous topic :: View next topic  
Author Message
evogroup



Joined: 01 Sep 2009
Posts: 4

PostPosted: Tue Sep 01, 2009 11:54 am     Display and format text from .txt file. Reply with quote

I am trying to display text on a page that is linked to a .txt file.

I have this code which works, but I cannot format the text.
The text is always displayed as black, arial.

<html>
<head>
<title>Untitled Document</title>


<IMG SRC="background.jpg">

<DIV STYLE="position:absolute; top:183px; left:13px; width:500px; height:55px">
<CENTER>
<FONT COLOR="#FF060F" SIZE="+2" face="Georgia, Times New Roman, Times, serif">
<object type="text/html" data="text.txt">

</object>
</FONT>
</CENTER>
<div> <font color="#FF060F">
<?php include("text.txt"); ?>
</font></div>
</div>
</body>
</html>
sticks464



Joined: 31 Dec 2006
Posts: 2625

PostPosted: Tue Sep 01, 2009 1:08 pm     Reply with quote

All you can format is the text color because there are no html tags to set styling rules for except the font. The color can be set like this
Code:
<div id="txt">
<?php include("text.txt"); ?>
</div>


css (put in head section of page)
Code:
<style type="text/css">
#txt {color:#FF060F;
font-family:"Georgia", Times New Roman, Times, serif;
font-size:14px;
position:absolute;
top:183px;
left:13px;
width:500px;
height:55px;
}
</style>
evogroup



Joined: 01 Sep 2009
Posts: 4

PostPosted: Tue Sep 01, 2009 8:55 pm     Reply with quote

Thanks, although I'm not quite getting it.
Like this?

<html>
<head>
<style type="text/css">
#txt {color:#FF060F;
font-family:"Georgia", Times New Roman, Times, serif;
font-size:14px;
position:absolute;
top:183px;
left:13px;
width:500px;
height:55px;
}
</style>
</head>
<body>


<div id="txt">
<?php include("text.txt"); ?>

</div>
</body></html>
sticks464



Joined: 31 Dec 2006
Posts: 2625

PostPosted: Tue Sep 01, 2009 9:22 pm     Reply with quote

That's how you do it. CSS inside style tags in the head section.
evogroup



Joined: 01 Sep 2009
Posts: 4

PostPosted: Tue Sep 01, 2009 9:37 pm     Reply with quote

I just get a blank page in FireFox and Safari.
sticks464



Joined: 31 Dec 2006
Posts: 2625

PostPosted: Wed Sep 02, 2009 4:04 am     Reply with quote

Do you have a server installed (like wamp)?
Php is server side language and is parsed by the server not the browser. You will need to install a server if you want to see the results of php in your browser prior to uploading to a hosting server.
evogroup



Joined: 01 Sep 2009
Posts: 4

PostPosted: Wed Sep 02, 2009 7:28 am     Reply with quote

No server installed.

I just sent you a PM.

Thanks.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> General HTML All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial