php and style sheets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chazzy69
    New Member
    • Sep 2007
    • 196

    php and style sheets

    Not sure if this is the right section to be posting to but anyway,

    I was wondering if you have a php script within a html page and on that html page you have a link .css file, can that .css have an effect on tags that are echo within the php script.

    For example if you had some formatting for a paragraph tag (e.g. defined the font-family) would it effect this

    [PHP]echo "<p> This is some text </p>";[/PHP]

    Any help is welcome thanks
  • chazzy69
    New Member
    • Sep 2007
    • 196

    #2
    Not to worry i figured out myself, the only reason i asked was becuase i was having some strange outcomes when applying the stylesheet to a php document that shouln't have happened lol.

    Thanks anyways

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Originally posted by chazzy69
      Not sure if this is the right section to be posting to but anyway,

      I was wondering if you have a php script within a html page and on that html page you have a link .css file, can that .css have an effect on tags that are echo within the php script.

      For example if you had some formatting for a paragraph tag (e.g. defined the font-family) would it effect this

      [PHP]echo "<p> This is some text </p>";[/PHP]

      Any help is welcome thanks
      Yes, of course it would. PHP outputs HTML the same, so the styles will still be applied.

      But I see you answered yourself now. :P

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Yep. The key thing to remember is that PHP is executed server-side, only returning it's output to the client, which is then used by the client just as any normal HTML / CSS /JavaScript or whatever else client-side content would be used.

        Comment

        • zabsmarty
          New Member
          • Feb 2007
          • 25

          #5
          for example
          Code:
          echo "<font color='#000000' size='Arial'> this is sample text</font>"
          hope you will clear let me know

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by zabsmarty
            for example
            Code:
            echo "<font color='#000000' size='Arial'> this is sample text</font>"
            hope you will clear let me know
            Explain ?

            Comment

            • Atli
              Recognized Expert Expert
              • Nov 2006
              • 5062

              #7
              Originally posted by zabsmarty
              for example
              Code:
              echo "<font color='#000000' size='Arial'> this is sample text</font>"
              hope you will clear let me know
              First of all, your are using the <font> tag incorrectly. You put 'Arial' in the size attribute...

              Besides that, I wouldn't recommend using this type of markup. The <font> tag is ancient and you would be far better of replacing it with a <span> using CSS styles. They give you a lot more options than the <font> tag.

              For example, to replace the tag you posted (without the bug), I could do this:
              [code=html]
              <span style="color: #000; font-family: Arial; size: 12pt;">
              This is sample text
              </span>
              [/code]
              And you have the option of adding CSS styles and even moving the styles out of the markup entirely.

              Comment

              Working...