简体   繁体   English

IE 8 CSS评论问题

[英]IE 8 css comment question

您好,一如既往,firefox和IE 8中的网站外观有所不同,现在我的问题是我的某些段落未正确对齐,因此我想为其添加一些页边距属性,问题是它们没有可以在样式表中找到,但可以在样式标签内的html的head元素中找到。

Maybe try 也许尝试

 <!--[if gt IE 6]>

.... .... .... .... .... ....

<![endif]-->

Change new style inside .. style 更改..样式内的新样式

Presuming you mean the CSS is in the head element of your HTML instead of in your CSS file, what problem are you having removing the CSS in the head element and putting it in your stylesheet? 假设您是说CSS位于HTML的head元素中,而不是CSS文件中,那么您将head元素中的CSS删除并将其放入样式表中会遇到什么问题?

For example, instead of: 例如,代替:

<head>
<style type="text/css">
hr {color:sienna}
p {margin-left:20px}
body {background-image:url("images/back40.gif")}
</style>
</head>

Put these three lines in your CSS: 将以下三行放入CSS:

hr {color:sienna}
p {margin-left:20px}
body {background-image:url("images/back40.gif")}

For more, see the W3School's CSS How to . 有关更多信息,请参见W3School的CSS How to

If you can only change the stylesheet, then try using !important to override the styles defined in the head element: 如果只能更改样式表,请尝试使用!important覆盖head元素中定义的样式:

p { margin-left: 50px !important; }

You can move the css out of the header into a new css file named for that page (assuming this css is specific to this one page/section) then run conditional selection on the css sheet (which from your description I get the impression you have done already for others). 您可以将css从标头中移到以该页面命名的新css文件中(假设此css特定于该页面/部分),然后在css工作表上运行条件选择(从您的描述中我得到的印象是已经为他人完成)。

Your other option would be to figure out why the code is not working on both browsers and adjust it until it works. 您的另一个选择是弄清楚为什么代码不能在两个浏览器上都起作用,并对其进行调整,直到它起作用为止。

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

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