Jump to content

Forms, CSS & IE8


Pavlos1316

Recommended Posts

Hello,

 

I just assembly a form and for styling it I am using CSS in an external file. Problem is that IE8 and I don't know about 7  (in IE9 is ok) it doesn't show the styling inside the form... My structure is something like this:

(in any other situation my css styling is displayed normally)

<form>
<span class="myclass">

</span>
</form>

Is there any fix for it?

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/246684-forms-css-ie8/
Share on other sites

working fine in IE8 for me,

test.css

.txt {
color: #f0f;
}

 

test.htm

<html>

<head>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>

<body>
test
    <form>
    <span class="txt">
    Name
    <input />
    </span>
    </form>
</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/246684-forms-css-ie8/#findComment-1266747
Share on other sites

Target IE versions with CSS "Hacks"

 

More to your point, here are the hacks that let you target IE versions.

 

Use “\9" to target IE8 and below

Use “*" to target IE7 and below

Use “_" to target IE6.

body { 
    border:1px solid red; /* standard */
    border:1px solid blue\9; /* IE8 and below */
    *border:1px solid orange; /* IE7 and below */
    _border:1px solid blue; /* IE6 */
}

Link to comment
https://forums.phpfreaks.com/topic/246684-forms-css-ie8/#findComment-1266765
Share on other sites

Target IE versions without hacks using HTML and CSS

 

If you don't want hacks in your CSS. Add a browser-unique class to the <html> element so you can select based on browser later.

 

<!doctype html>

<!--[if IE]><![endif]-->

<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6">    <![endif]-->

<!--[if IE 8 ]>    <html lang="en" class="no-js ie8">    <![endif]-->

<!--[if IE 9 ]>    <html lang="en" class="no-js ie9">    <![endif]-->

<!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]-->

    <head></head>

    <body></body>

</html>

 

 

In CSS

.ie6 body { 
    border:1px solid red;
}
.ie7 body { 
    border:1px solid blue;
}

Link to comment
https://forums.phpfreaks.com/topic/246684-forms-css-ie8/#findComment-1266767
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.