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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.