php - Joomla 2.5 - 为 iPad 添加自定义 CSS

标签 php html css joomla joomla2.5

我想在 iPad 上查看我的 joomla 网站时加载一个 css 文件。

我使用的 joomla 版本是 2.5。

我目前为浏览器设置了样式表,例如Internet Explorer 和 Firefox 但不确定如何告诉网站加载专门用于设备的 css 文件,例如iPad。

如有任何帮助,我们将不胜感激。

最佳答案

@isher 的回答是一个很好的方法,但是要导入 CSS 文件,我会这样做,使用 Joomla 编码标准:

<?php
$isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad');

if ($isiPad){    
   $doc = JFactory::getDocument(); //only include if line doesn't already exist
   $doc->addStyleSheet (JURI::root() . "template/template-name/ipad-styles.css" );
}
?>

关于php - Joomla 2.5 - 为 iPad 添加自定义 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14305220/

相关文章:

javascript - 当 html 文件中遇到 &lt;script&gt; 标签时会发生什么?

jquery - 具有绝对位置的多个叠加层,固定到它们的父元素,作为相同的标记

php - 倒数计时器无法正常工作

php - 无法从下拉列表 PHP 获取数据到 Xampp MySQL

php - 需要在 Web 开发抽象的所有层中访问相同的 bool 结果

php - 使用 Php 设计 'Restaurant System'

html - 覆盖内联样式

html - 两列布局,不同高度的图像

asp.net - 在不使用表格的情况下安排动态生成的标签和 aspx-Controls 看起来像字典

css - 每个循环中的 sass 变量插值