believeinsharing Posted October 19, 2011 Share Posted October 19, 2011 I want to use css and PHP together Let say I have simple PHP page: <html> <head> <title>Coupon Sample </title> </head> <body> <div id="test"> <?php echo ("Test"); ?> </div> </body></html> Now if I want to add css to this I have two options 1. add css code in head tag 2. add external css file with <link> tag My simple css is #test { color:orange; } if I am using first option like <html> <head> <title>Coupon Sample </title> #test { color:orange; } </head> Its working fine, for second option <title>Coupon Sample </title> <link rel="stylesheet" type="type/css" href="simple.css"/> </head> where simple.css contain css code but its not working.. it shows text in black color instead of orange Does anyone has idea about it. or is their other way to add css in this situation. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/249403-css-not-working-with-php/ Share on other sites More sharing options...
premiso Posted October 19, 2011 Share Posted October 19, 2011 This is not a PHP issue by any means, nor is it really a CSS issue. But PHP is completely irrelevant. Your problem is in your HTML link tag within the type attribute. It should be: type="text/css" Quote Link to comment https://forums.phpfreaks.com/topic/249403-css-not-working-with-php/#findComment-1280561 Share on other sites More sharing options...
Far Cry Posted October 19, 2011 Share Posted October 19, 2011 This is not a PHP issue by any means, nor is it really a CSS issue. But PHP is completely irrelevant. Your problem is in your HTML link tag within the type attribute. It should be: type="text/css" Also, there is no need for the braces after an echo statement, as it is not a function, but rather a language construct. Quote Link to comment https://forums.phpfreaks.com/topic/249403-css-not-working-with-php/#findComment-1280572 Share on other sites More sharing options...
premiso Posted October 19, 2011 Share Posted October 19, 2011 Also, there is no need for the braces after an echo statement, as it is not a function, but rather a language construct. *premiso shrugs Don't really see how that is relevant here but good information (I guess). But either or, the braces or no braces it will echo out fine, more of a personal preference. Quote Link to comment https://forums.phpfreaks.com/topic/249403-css-not-working-with-php/#findComment-1280575 Share on other sites More sharing options...
believeinsharing Posted October 19, 2011 Author Share Posted October 19, 2011 @premiso: I M so sorry, for such a small mistake Its working fine nw, Thx... Quote Link to comment https://forums.phpfreaks.com/topic/249403-css-not-working-with-php/#findComment-1280577 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.