douduandiao1368 2015-10-30 11:55
浏览 67
已采纳

来自外部服务器的CSS @import,比如get query

I have spent the past few days but I can not find a solution.

I try to import an external CSS directly from the CSS file using @import rule like this:

@import url(http://myanothersite.com/styles.php?style=1);

I need my external site using a php script gave the desired style depending on get request. But the problem is that the external site with the script does not give any style line. Maybe someone knows how to solve this problem.

Something similar had seen with fonts from Google, there is a script

https://fonts.googleapis.com/css?family=Ubuntu:400&subset=latin

and result is

@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 400;
src: local('Ubuntu'), url(https://fonts.gstatic.com/s/ubuntu/v8/sDGTilo5QRsfWu6Yc11AXg.woff2) format('woff2');
}
  • 写回答

1条回答 默认 最新

  • dongpo2002 2015-10-30 12:03
    关注

    You have to set the content type of your PHP file to CSS. Just simply place the following line on the top of your PHP code:

    header("Content-type: text/css");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100