Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 458585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:41:11+00:00 2026-05-12T22:41:11+00:00

I have some mark up and I am trying to have the hints for

  • 0

I have some mark up and I am trying to have the “hints for some input” light up when the accosicated text input has focus. I am trying to use the focus pseudo class along with a sibling selector. If i just use one or the other it works just fine. However, when combining them in IE8 it apears as if that style doesn’t get updated when you tab through the textboxes. NOTE: that if you click away from the textbox and back they style is updated.

Here is the markup:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        html { font-family: Arial; }
        .lineItem {padding:5px; clear:both; }
        .label { display:block; font-size:large; color: #2C2F36; font-weight:bold; padding:5px 0px 3px 0px; }
        .textbox:focus { background-color: #FFFFBF; }       
        .textbox { font-size: large; color: #2C2F36; width:300px; background-color: #FFFFE8; padding:3px 5px; border:solid 2px #cecece; float:left; }
        .hint {  margin-left:10px; width:175px; font-size:smaller; display:block; float:left; color: #466E62; }
        .textbox:focus+.hint {color: Red; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div class="lineItem">
            <label for="ListName" class="label">List Name</label>
            <input id="Name" name="ListName" type="text" class="textbox" />
            <span class="hint" id="NameHint">This is the title of your List.</span>
        </div>
        <div class="lineItem">
            <label for="ListSlug" class="label">http://List/Username/</label>
            <input id="Slug" name="ListSlug" type="text" class="textbox" />
            <span class="hint" id="SlugHint">The URL that you will use to share your list with others.</span>
        </div>
    </div>
    </form>
</body>
</html>

Here is a screenshot of what I’m seeing:


Screenshot http://www.osbornm.com/pics/IE8Issue.png

NOTE: Works in other browsers 🙁 and other pseudo classes such as hover work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:41:11+00:00Added an answer on May 12, 2026 at 10:41 pm

    According to http://www.quirksmode.org/css/contents.html Adjacent Sibling Selectors are not correctly supported by IE browsers, and based on that I am afraid I must say – sorry, you cannot achive what you want using CSS only.

    But you can use jQuery, and this is how you can do it:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <style type="text/css">
            html { font-family: Arial; }
            .lineItem {padding:5px; clear:both; }
            .label { display:block; font-size:large; color: #2C2F36; font-weight:bold; padding:5px 0px 3px 0px; }
            /* .textbox:focus { background-color: #FFFFBF; } */
            .textbox { font-size: large; color: #2C2F36; width:300px; background-color: #FFFFE8; padding:3px 5px; border:solid 2px #cecece; float:left; }
            .hint {  margin-left:10px; width:175px; font-size:smaller; display:block; float:left; color: #466E62; }
            /* .textbox:focus + .hint {color: Red; } */
            .hintOn { color:Red; }
            .textboxOn { background-color: #FFFFBF; }
        </style>
        <script type="text/javascript" src="http://ajax.Microsoft.com/ajax/jQuery/jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            var Hints = {
                Swap: function(obj) {
                    $(obj).parent().find('.hint').toggleClass("hintOn");
                    $(obj).toggleClass("textboxOn");
                },
                Init: function() {
                    $(function() {
                        $('.textbox').focus(function() {
                            Hints.Swap(this);
                        }).blur(function() {
                            Hints.Swap(this);
                        });
                    });
                }
            };
            Hints.Init();
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <div class="lineItem">
                    <label for="ListName" class="label">List Name</label>
                    <input id="Name" name="ListName" type="text" class="textbox" />
                    <span class="hint" id="NameHint">This is the title of your List.</span>
            </div>
            <div class="lineItem">
                    <label for="ListSlug" class="label">http://List/Username/</label>
                    <input id="Slug" name="ListSlug" type="text" class="textbox" />
                    <span class="hint" id="SlugHint">The URL that you will use to share your list with others.</span>
            </div>
        </div>
        </form>
    </body>
    </html>
    

    In my solution I included reference to Microsoft hosted jQuery, and wrote simple method to apply styles you need. You can easily modify “highlighted” state of hint and input box by amending your CSS classes.

    I have tested my solution on IE6, IE7, IE8, Firefox, Opera, Chrome and Safari and it is working correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some mark-up like so: <div class=slideshow> <div class=slide style=display:block;></div> <div class=slide style=display:none;></div>
I have @hash that looks like this: [1, {:clid=>1, :nvz=>4, :tip=>IP, :name=>Mark, :record=>some text}]
I'm trying to use many-to-many relation in Hibernate Framework, but I have some troubles.
I'm trying to use a Webview to add some text around a graph produced
my problem is: I have an image and want to mark some areas over
Some Windows native applications have a question mark icon on the title bar. It's
I have some text lines like that : vt_wildshade2^508^508 vt_ailleurs2^1188^1188 ... vt_high2^13652^13652 Is it
I'm trying to write a class that has a generic member variable but is
I need to abstract some behavioural code and have a problem trying to reference
I'm trying to read CSV files using Java. Some of the files may have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.