简体   繁体   English

CSS Internet Explorer骇客

[英]css internet explorer hacks

Im using a rockettheme template and have edited some of the css code using a custom css file. 我正在使用rockettheme模板,并使用自定义的css文件编辑了一些css代码。

I have managed to get it how I want it to look on Firefox and Chrome however IE looks werid. 我设法获得了它希望它在Firefox和Chrome上显示的效果,但是IE看起来很糟糕。 the navigation is too low (the buttons) and the header is also too low. 导航太低(按钮)并且标题也太低。

The website link is found below. 网站链接如下。

http://www.colmanprint.co.nz/rfloorings/ http://www.colmanprint.co.nz/rfloorings/

as you can see on the link the menubar is down too low and the header. 正如您在链接上看到的那样,菜单栏太低且标题太低。

at the moment im using a css code edit .rt-menubar {padding: 0px !important; 目前,我正在使用CSS代码编辑.rt-menubar {padding:0px!important; margin-left:210px;} when i remove the margin-left:210px; margin-left:210px;}当我删除margin-left:210px;时 it fixes my problem but then the menu goes behind the logo on chrome and firefox. 它解决了我的问题,但是菜单位于chrome和Firefox的徽标后面。

so i pretty much need to keep the margin-left:210px for chrome and firefox but have margin-left:0px for internet explorer 因此,我非常需要为Chrome和firefox保留margin-left:210px,但为Internet Explorer提供margin-left:0px

any ideas would be great! 任何想法都很棒!

For versions of Internet Explorer up to IE9, you could use conditional comments to differentiate between IE and other browsers. 对于IE9以下的Internet Explorer版本,您可以使用条件注释来区分IE和其他浏览器。

Here's a quick example: 这是一个简单的示例:

<!--[if IE]> 
  <link rel="stylesheet" type="text/css" href="ie9-and-below.css" />
<![endif]-->

Then in ie9-and-below.css you could apply a style such as: 然后在ie9-and-below.css可以应用如下样式:

#ieParagraph.rt-menubar {
   margin-left:0px;
}

Where your HTML could look like so: HTML可能如下所示:

<div class="rt-menubar" id="ieParagraph">
   <ul>Other stuff here...</ul>
</div>

If no styling was applied in your other stylesheets to #ieParagraph where the class was also .rt-menubar , this would only change the left margin of the #ieParagraph div to 0px in IE9 and under only . 如果您的其他样式表中的样式也为.rt-menubar的其他样式表中#ieParagraph应用任何样式,则这只会在IE9中和only之下#ieParagraph div#ieParagraph更改为0px


For IE10, conditional comments have been removed - look into using Modernizr for feature detection. 对于IE10,已删除条件注释-请考虑使用Modernizr进行特征检测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM