سؤال

I need html5 scripts to be opened by IE7.

I did input a script to call html5shiv.js on <head> script in the HTML file.

Here's my HTML code:

<head>
  <!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/style_ie.css" />
<script type="text/javascript" src="js/html5shiv.js"></script>
  <![endif]-->
</head>

and I trying to styling a button on tag <header> like this:

HTML:

<header>
<input type='submit' value='LOGIN'>
</header>

CSS:

header input[type=submit]{
    background:url('../images/btn_login.png')repeat-x; 
    color:white;
}

and that's still not working, I don't know where the error is? are the error on the caller of html5shiv or in some of the syntax?

NOTE: no CSS class like .Something Allowed

هل كانت مفيدة؟

المحلول

Include html5shiv.js before style_ie.css:

<head>
  <!--[if IE]>
    <script type="text/javascript" src="js/html5shiv.js"></script>
    <link rel="stylesheet" type="text/css" href="css/style_ie.css" />
  <![endif]-->
</head>

نصائح أخرى

Use it as a class example

.btn 
   {
   background:url('../images/btn_login.png')repeat-x;
   color:white;
   }

and use it in html as

<header>
<input type='submit' value='LOGIN' class='btn'>
</header>

The Internet Explorer 7 have a buggy support for the attribute selector. to prevent this issue it would be goo if you can make a class and then apply it on input tag. I hope it will work on IE7 or even IE6.

NEW SOLUTION

you have to call the html5shiv.js and CSS file separately like this way.

<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5shiv.js"></script><![endif]
-->

<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/style_ie.css" />
<![endif]-->

OLDER SOLUTION

<input type='submit' value='LOGIN' class='myClass'>

CSS would be

.myClass{border:1px solid red;}

IE7 not supported this attribute of HTML file so you can not use header input[type=submit]{ }

i need create class for ie7 and check browser if it is less than IE8 then you call that class.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top