Hi

I was wondering if anyone can help. I have integrated a blog into a website using some code from another webste. Everything works but I do not know how to change the font type and colour for the text when it is on the website. The code is:

      <?php



include "common.php";



$sql = "select * from blog order by added desc";



$link = mysql_query($sql,$cn);



while($data = mysql_fetch_row($link))



{
//print_r($data);


echo "<hr class=\"c\"><h5>";



$tdate=strtotime($data[0]);
if($data[0]!='')
	echo date('m-d-y | h:i a',$tdate);



echo "</h5>


<h4 class=\"gold\">



$data[1]



</h4><br>



$data[2]



<p><div id=\"grey\">



$data[3]



</div>";



}







?>

If you need any more code please let me know.

Many thanks in advance for your help.

AC

MOD EDIT: PHP bbcode tags added, please use these in the future.

    Specifically, which text are you trying to change? If you're talking about the div with the id of "grey" (which would be your $data[3]), then in your CSS, find your div using the same id and modify it accordingly. Same thing with H5, H4, etc... It looks like it is just simple CSS stuff... Correct me if I am wrong.

      Thank you for your reply. To be honest I have never used PHP before so I don't know what all the code means in it.

      Also there are no direct links in the CSS for the code. For example there is no $data[3] defined in the CSS.

      What would the CSS have to say for example for Century Gothic font, size 12, and colour black, for say looking at the code above H5?

        This has less to do with PHP and more to do with HTML.

        echo "</h5><h4 class=\"gold\"><font color=red>$data[1]</font>";

          As the <font> tag is deprecated, the up-to-date method is to use a style attribute (or better yet, as CSS stylesheet). E.g.:

          <p style="font: 90% arial, helvetica, sans-serif;color: #990000;">This is some text.</p>
          
            ac1234 wrote:

            Thank you for your reply. To be honest I have never used PHP before so I don't know what all the code means in it.

            Also there are no direct links in the CSS for the code. For example there is no $data[3] defined in the CSS.

            What would the CSS have to say for example for Century Gothic font, size 12, and colour black, for say looking at the code above H5?

            if you have a separate style sheet, it would look something like this:

            h5 {
            font-family: century cothic;
            font-size: 12px;
            color: #000000;
            }

            I'm just not sure how your styles are currently being defined and implemented with the code you provided...

              Current styles are like this:

              .style25 {color: #FFFFFF}
              .style29 {font-family: "Century Gothic"; font-size: 12px; }
              .style26 {
              font-family: "Century Gothic";
              font-size: 14px;
              color: #003366;
              font-weight: bold;

                Thanks...the code that you gave me works now. There are three different rows of code though...I have identified 2 which are marked as H4 and H5 but can anyone identify the other bit of code for the last row? Thanks.

                  ac1234 wrote:

                  Current styles are like this:

                  .style25 {color: #FFFFFF}
                  .style29 {font-family: "Century Gothic"; font-size: 12px; }
                  .style26 {
                  font-family: "Century Gothic";
                  font-size: 14px;
                  color: #003366;
                  font-weight: bold;

                  That can't be all of it. Your style26 class isn't closed.

                  At any rate, those that start with the period ( . ) like that are CSS class definitions, so you'd need to find where the class attribute is actually set within the HTML itself. You might want to post all of the code and CSS because the bits & pieces thing isn't working.

                  If you need help with CSS, you may want to Google something like "CSS Tutorial" or visit http://www.w3.org and read up on how to implement CSS.

                    ac1234 wrote:

                    Thanks...the code that you gave me works now. There are three different rows of code though...I have identified 2 which are marked as H4 and H5 but can anyone identify the other bit of code for the last row? Thanks.

                    You could do something like this:

                    div {
                    font-family: century cothic;
                    font-size: 12px;
                    color: #000000;
                    }

                    OR

                    div.data3style {
                    font-family: century cothic;
                    font-size: 12px;
                    color: #000000;
                    }

                    (and use the class attribute definition of the div tag - That's an HTML/CSS thing and not a PHP thing.) Again, check out the W3 website on CSS or Google for CSS help.

                    OR

                    div#grey {
                    font-family: century cothic;
                    font-size: 12px;
                    color: #000000;
                    }

                    (This would support your current setup as is, but review the W3 specs for CSS to understand the differences between CSS classes and ids.

                      Change

                      grey {
                      font-family: century gothic;
                      font-size: 12px;
                      color: #000000;
                      }

                      to

                      div#grey {
                      font-family: century gothic;
                      font-size: 12px;
                      color: #000000;
                      }

                      AGAIN, you should find some CSS stuff to read up on the use of CSS ID and CLASS attribute definitions. Sounds like you are trying to run with CSS before you know how to crawl with it...

                        Great...looks like it all works now. Thanks for all your help. Next stop is learning about CSS!

                          Write a Reply...