By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

php and style sheets

100+
P: 196
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
Oct 26 '08 #1
Share this Question
Share on Google+
6 Replies


100+
P: 196
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
Oct 26 '08 #2

Markus
Expert 5K+
P: 6,050
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
Oct 26 '08 #3

Atli
Expert 5K+
P: 5,058
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.
Oct 26 '08 #4

zabsmarty
P: 25
for example
Expand|Select|Wrap|Line Numbers
  1.  
  2. echo "<font color='#000000' size='Arial'> this is sample text</font>"
  3.  
hope you will clear let me know
Oct 28 '08 #5

Markus
Expert 5K+
P: 6,050
for example
Expand|Select|Wrap|Line Numbers
  1.  
  2. echo "<font color='#000000' size='Arial'> this is sample text</font>"
  3.  
hope you will clear let me know
Explain ?
Oct 28 '08 #6

Atli
Expert 5K+
P: 5,058
for example
Expand|Select|Wrap|Line Numbers
  1.  
  2. echo "<font color='#000000' size='Arial'> this is sample text</font>"
  3.  
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:
Expand|Select|Wrap|Line Numbers
  1. <span style="color: #000; font-family: Arial; size: 12pt;">
  2.   This is sample text
  3. </span> 
  4.  
And you have the option of adding CSS styles and even moving the styles out of the markup entirely.
Oct 28 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.