Reputation: 145
I'm including css using php like
<?php include "css/cssnew.css"; ?>
But Font Awesome not working, icons showing as squares
css:
@font-face {
font-family: FontAwesome;
src: url(/css/fonts/fontawesome-webfont);
font-weight: 400;
font-style: normal
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}
.fa-angle-double-up:before {
content: '\f102';
}
Can anyone please tell me why that fa-angle-double-up:before is not showing
content: '\f102';
Upvotes: 2
Views: 15024
Reputation:
Well I saw this two options. I hope it helps.
<?php echo '<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">'; ?>
<!-- or -->
<style><? include_once ”PATH/your_style.css" media ="" ?></style>
// <style><? require_once ”PATH/your_style.css" media ="" ?></style>
<!--Good Luck I hope it helps!-->
Upvotes: 1
Reputation: 2468
As your comment says, You can save below php code as newcss.php
<?php echo '<link href="css/cssnew.css" rel="stylesheet">'; ?>
Now dynamically include in your PHP file as
<?php
include 'newcss.php';
?>
Upvotes: 0
Reputation: 1939
I know, there are 3 method for adding CSS to HTML and echo with PHP:
<?php echo '<link rel="stylesheet" type="text/css" href="style.css" media="screen" />';
In this method, you can add your CSS codes in CSS file style.css
and echo HTML <link>
with PHP.
<?php echo '<style media="screen" type="text/css">Add style rules here</style>'; ?>
Example:
<?php echo '<style media="screen" type="text/css">@font-face{font-family:FontAwesome;src:url(/css/fonts/fontawesome-webfont);font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-angle-double-up:before{content:"\f102"}</style>'; ?>
<style><?php include "css/cssnew.css"; ?></style>
Or
<?php
echo '<style>';
include "css/cssnew.css";
echo '</style>'
;?>
Upvotes: 2
Reputation: 330
You have to use CSS with tag.
<style>
<?php
include 'css/cssnew.css';
?>
</style>
you can also use HTML tag.
<?php
echo '<link href="css/cssnew.css" rel="stylesheet">';
?>
Upvotes: 1
Reputation: 1668
Try like below
Inside HTML
<link rel="stylesheet" href="css/cssnew.css" type="text/css">
Inside Php
<?php echo '<link href="css/cssnew.css" rel="stylesheet" type="text/css" >'; ?>
Upvotes: 0