davemcc Posted October 22, 2007 Share Posted October 22, 2007 Hello I am very much new to this, I have the following prob i cant seem to work out. I display a .txt file via php but i cant adjust the font etc. via CSS. This is the site im working on and the php used... http://mickleovercommunitycentre.co.uk/Oakwood/nnn/index.php Any help would be great. Thanks Dave Quote Link to comment https://forums.phpfreaks.com/topic/74304-using-css-to-adjust-php/ Share on other sites More sharing options...
wildteen88 Posted October 22, 2007 Share Posted October 22, 2007 From the link you supplied I see you are using the following code to grab the news from text file: <?php lines = file("news.txt"); foreach($lines as $ln) { echo "$ln<br />"; } ?> You'll want to wrap that code in some div tags and then give the div an id of news. That way you can then style the text how you want it to display. Example Code: <style type="text/css"> #news { color: #F00; border: 2px solid #333; padding: 10px; font: 12px Arial; } </style> <div id="news"> <?php $lines = file("news.txt"); foreach($lines as $ln) { echo "$ln<br />"; } ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/74304-using-css-to-adjust-php/#findComment-375589 Share on other sites More sharing options...
davemcc Posted October 23, 2007 Author Share Posted October 23, 2007 Thanks for that! I can now alter text but the border still remains... I am doinhg this for a Community Centre website. I basically want to display .txt files in divs, borderless but be able to constrain the width the txt is diplayed at. Any help would be great as im a bit lost! Thanks Dave Quote Link to comment https://forums.phpfreaks.com/topic/74304-using-css-to-adjust-php/#findComment-376128 Share on other sites More sharing options...
wildteen88 Posted October 23, 2007 Share Posted October 23, 2007 Well just set the width you want the div to be in order to constrain the text. Add: width: 300px; To the #news style in your CSS. This will make the news text only take up 300 pixels of the page Quote Link to comment https://forums.phpfreaks.com/topic/74304-using-css-to-adjust-php/#findComment-376303 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.