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 6920495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:09:16+00:00 2026-05-27T10:09:16+00:00

having a blonde moment here, trying to use CSS to tell a divider to

  • 0

having a blonde moment here, trying to use CSS to tell a divider to change its background once an input has focus.

<p>
    <label>Your Name</label>
    <input type="text" name="your_name" id="your_name" value="" />
    <div class="formhelper">Please enter your full name,<br />Character limit of 255</div>
</p>

Thats the HTML code, now I’ve tried the following but can’t get it to work

.appformwrapper input:focus + div {
    background-color: #CCC !important;
    display: block;
} 
.appformwrapper div ~ input:focus {
    background-color: #CCC !important;
}
.appformwrapper input:focus {
    background-color: #EEF;
} 

Any ideas? I’ve done this once before in CSS but can’t find me blasted code 🙁

  • 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-27T10:09:17+00:00Added an answer on May 27, 2026 at 10:09 am

    It’s not valid HTML to have a div in a p. Browsers will take your markup and treat it as this:

    p
      label
      input
    div
    

    Which means your div actually comes after the p, rather than being inside it. So while you’re trying to select a div that comes after an input, it won’t work because the div doesn’t exist in that position.

    If you can change your p to another div, or your existing div to a span, your CSS should work. I’m not sure what exactly your second rule is supposed to do either, but it still won’t work, as the general sibling selector ~ doesn’t look at previous siblings.

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

Sidebar

Related Questions

I'm having a blonde moment, here is my problem: Break down: I have an
I'm having a 'blonde moment' here - I'm sure this is easy but I
Having a duh moment trying to implement a new content page Here's the structure
Ok I must be having a blonde moment, but for the life of me
I'm having a blonde moment and probably a brain freeze. In my rails3 app,
Having a hard time with labels on a ggplot2 plot. Here's a similar plot
I'm trying to determine how to transform my meaningful input into data for an
Having C++ console utility. The code inside parses the command line input and depending
I'm having difficulty changing the calue of a dropdown menu using jquery. <div class=input-box>
I'm having trouble trying to set the value of a property after i cast

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.