鉴于代码(看起来它应该是有效的):
<!--[if lt IE 7]> <style type="text/css" media="screen">
<!--
div.stuff { background-image: none; }
--></style><![endif]-->
Run Code Online (Sandbox Code Playgroud)
W3C验证器抛出一个拟合:
等等
我不完全确定最新情况.这是'嵌套'评论吗?该标记由Zend Framework Viewhelper headStyle生成
$this->headStyle()->prependStyle('div.stuff { background-image: none; }',
array('conditional' => 'lt IE 7')
);
Run Code Online (Sandbox Code Playgroud) 如何添加条件,以便用户运行IE6或更少时不加载某些javascript.我尝试了以下内容,并且<script>不会在任何浏览器中加载:
<!--[if gt IE 6]>
<script blah blah blah... />
<![endif]-->
<!--[if ! IE 6]>
<script blah blah blah... />
<![endif]-->
<!--[if !IE 6]>
<script blah blah blah... />
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
一些援助将不胜感激.
我目前正在为主页开发主题,但遇到了一些问题.无论出于何种原因,我无法编辑html代码本身,我需要为IE编写自定义.css(特别是IE9以下的版本).
我有"两个"问题.第一个是双重背景.IE9以下的版本似乎无法完美呈现它们.如果IE跳过元素,这很好,但由于此元素中的图形与另一个元素共同(为了平滑的图形转换),它使另一个元素看起来很奇怪.第二个元素中的图形是div框中的背景.我希望这个背景是另一个自定义背景,只有当用户使用IE作为浏览器时才会呈现; 如果可能的话,我希望这只适用于IE9以下的版本(在IE9中,网站使用双背景渲染).
http://patrikarvidsson.com/project/sohelp/illustration.jpg
CSS如下(#mainframe是标题导航框下的部分).较低的图像是在IE8中呈现的方式.IE7显示相同.第一个是FF/Chrome/Safari和IE9.
#mainframe {
background: url('img/bg2.png') no-repeat,
url('img/bg1.png') repeat-y !important;
}
Run Code Online (Sandbox Code Playgroud)
我在网上搜索了很多,也一直在问朋友,如果没有在html标记中编写条件注释,这似乎没有用.我错过了什么吗?仅使用.css文件,这是否可行?
网站正在使用jquery.我不知道这些东西,但我想我会提到它以防万一.
我正在使用Wordpress实现一个网站,但我的网站在Internet Explorer 8中不受支持.
有没有我可以使用的代码,以便任何IE8用户将被重定向到另一个页面?
javascript php wordpress conditional-comments internet-explorer-8
我最近有足够的时间对"CSS hacks"和"Conditional Comments"这个论点进行过充分的讨论,我认为我会把这个问题抛给Stack Overflow社区.
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="ie-specific.css" />
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
反对使用IE条件注释的主要论点似乎是您在每个页面加载上添加了额外的HTTP请求,从而减慢了页面的显示速度.我无法找到的任何实际指标都证明或反驳了这一说法.
撇开维护多个样式表与一个样式表的论点(尽管这本身就是一个有效的讨论),有没有人在这里做任何测试来确定使用条件注释给你带来的减速程度,或者能够指出我对任何其他人收集的任何统计数据的方向?
为什么在Internet Explorer 8上使用此HTML页面:
<p>
<!--[if IE]> According to the conditional comment this is Internet Explorer<br /><! [endif]-->
<!--[if IE 5]> According to the conditional comment this is Internet Explorer 5<br /> <![endif]-->
<!--[if IE 5.0]> According to the conditional comment this is Internet Explorer 5.0<br /> <![endif]-->
<!--[if IE 5.5]> According to the conditional comment this is Internet Explorer 5.5<br /> <![endif]-->
<!--[if IE 6]> According to the conditional comment this is Internet Explorer 6<br /> <![endif]-->
<!--[if IE 7]> …Run Code Online (Sandbox Code Playgroud) 我们将JSF升级到最新版本2.1.以前我们在JSF2.0.4.我们的xhtml页面具有Targeting IE Using Conditional Comments标记,这些标记未呈现为文本.
但是对于新的JSF2.1.7,这将在IE中呈现为文本.有任何想法如何解决这个问题?
在现代网页中,您经常会看到以下内容:
<!--[if IE 7]>
<html class="ie ie7" lang="en-US">
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" lang="en-US">
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html lang="en-US">
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)
目的显然是应用不同的html,具体取决于浏览器和浏览器版本.我认为这是在服务器端完成的,因为除了适当的部分外,似乎所有内容都被注释掉了.
在服务器上使用什么软件来根据访问浏览器选择要注释的部分?
我想在不同的浏览器上显示不同的内容。我使用了 Internet Explorer 11 和 Google Chrome 39。但是,在 Internet Explorer 和所有其他浏览器中显示“非 Internet Explorer”。代码有问题吗?我看到以下代码作为同一问题之一的答案,那么为什么它现在不起作用?
代码:
<!DOCTYPE html>
<html>
<body>
<!--[if (IE)]><p>This is Internet Explorer</p><![endif]-->
<!--[if !(IE)]><!--> Not Internet Explorer <!--<![endif]-->
</body>
</html>
Run Code Online (Sandbox Code Playgroud) html internet-explorer conditional-comments internet-explorer-11
我正在使用Vue生成一些html模板,我需要按照下面的代码包含html条件注释.
var productTemplate = new Vue({
el: '#myApp'
});Run Code Online (Sandbox Code Playgroud)
<script src="https://unpkg.com/vue@2.5.8/dist/vue.js"></script>
<div id="myApp">
<div class="some-content">
This is some content
</div>
<!--[if mso]>
<div>
this div will only be shown if the condition in the comment is true, in this case the condition is:
if ( mso (microsoft office) == the html rendering engine) {
show the html code between the [if mso] and the [endif]
}
</div>
<![endif]-->
<div class="some-other-content">
This is some content
</div>
</div>Run Code Online (Sandbox Code Playgroud)
但是当我在浏览器中打开我的html页面时,条件注释之间的html代码被完全删除,即使我确实需要它在那里.
如何让Vue在模板视图中包含这些注释?