chiefrokka Posted September 6, 2008 Share Posted September 6, 2008 b.Messages { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #99999; text-decoration: none; background-color: #CCFFFF; background-position: left; } how do I put the Name in bold, then do a carriage return, display message, then carriage return. All the <br> show up in the textarea. Also, how do i left justify it? it's showing up centered. i can use css to change color and bold and all that but it does the whole textarea text. <textarea name="Threads" class="Messages" id="Threads" cols="100" rows="3" disabled> <? // All Messages will go here $result = mysql_query("SELECT * FROM Messages ") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "".$row['Name']." | ".$row['Date'].""; echo "".$row['Message'].""; echo "------------------------------------------------"; } ?> </textarea> Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/ Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 You can not style parts of text within a textarea with CSS. Why you are you displaying results from a query in a textarea? Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635216 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 it's just a little mini message board I want to display. I have a little Submit Message text field under it that people can easily send messages. I just want a little small area on top right of my page that displays all the messages. it's not like vbullet, it's more like yahoo fantasy has in their "matchups" section that the league can post messages to Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635218 Share on other sites More sharing options...
The Little Guy Posted September 6, 2008 Share Posted September 6, 2008 Yeah, you can't style parts of a text field, but you can use BBCode like we do here. Your only other option is to use a div, and if you want users to edit the div, then you need to add javascript, and if your going to do that, might as well use Tinymce. Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635221 Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 Can you post an example of what you're trying to do. Not sure what you mean by Yahoo. Also you do not need to do "".$var."" when echoing a variabl. Just echo $var will do fine. Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635222 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 you are right, i can do just echo ($var); I'm just used to adding echo "<font color='#FF0000'>".$var."</font> blah blah"; here's what I'm trying to do. this is from Yahoo. notice how they have name in bold and all left justified [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635225 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 Here's how it's displaying now which I need help with [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635226 Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 To achieve the design you post in your message here. You'd do this <table border="0" cellspacing="1" cellpadding="5"> <?php // All Messages will go here $result = mysql_query("SELECT * FROM Messages ") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo <<<HTML <tr> <td><b>Name:</b> {$row['Name']}</td> <td><b>Date:</b> {$row['Date']}</td> </tr> <tr> <td colspan="2">{$row['Message']}</td> </tr> HTML; } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635264 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 I only want to display like 5 lines and have a scroll bar though. I don't want to display every single message in the db one after another without a scroll Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635271 Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 Set a the height for your table, then apply an overflow. Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635276 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 Set a the height for your table, then apply an overflow. not sure what you mean by overflow. can you explain a little more Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635277 Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 The overflow is applied using CSS, check out the following. It includes examples. Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635281 Share on other sites More sharing options...
chiefrokka Posted September 6, 2008 Author Share Posted September 6, 2008 ok cool. I got it to work. I used that example code but change the "div" to "p" because I didn't want all my div to scroll throughout my code and I rarely use <p> so I just used that tag with yours and it now scrolls. thanks! <style type="text/css"> p { background-color:#00FFFF; width:350px; height:150px; overflow: scroll } </style> </head> Quote Link to comment https://forums.phpfreaks.com/topic/123018-help-using-css-with-textarea/#findComment-635304 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.