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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:24:08+00:00 2026-05-28T04:24:08+00:00

So, I have a simple login page that has a light green background, and

  • 0

So, I have a simple login page that has a light green background, and would like to change the background color to a light red when the ‘loginbox’ div with id = ‘loginbox’ also has a class ‘error’. My page looks as follows:

VALID HTML http://i1154.photobucket.com/albums/p525/covertcj/ScreenShot2012-01-16at20759PM.png

with the relavent HTML looking like:

HTML (Before adding error class):

<div id="loginbox">
    <span>Username:</span>
    <input>

    <span>Password:</span>
    <input>

    <button>Submit</button>
</div>

With the CSS given below, I feel that this should work; however, when adding the error class to the div, nothing happens.

CSS:

#loginbox {
    margin: auto;
    padding: 25px 50px;
    width: 300px;
    height: 100px;
    border: 1px solid #e9e9e9;
    background: #EBFFEF; 
}
#loginbox .error {
    background: #FFEBEB; 
}
#loginbox input {
    height: 15px;
    margin: 3px 0px;
    width: 190px;
    float: right;
}
#loginbox span {
    height: 15px;
    width: 60px;
    margin: 3px 0px;
    padding: 3px 0px;
    float: left;
}
#loginbox button {
    margin-top: 30px;
    float: right; 
}

HTML (After after error class):

<div class="error" id="loginbox">
    <span>Username:</span>
    <input>

    <span>Password:</span>
    <input>

    <button>Submit</button>
</div>

Am I possibly misusing this technique? Any help in this matter would be greatly appreciated.

Thanks,
Chris Covert

  • 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-28T04:24:08+00:00Added an answer on May 28, 2026 at 4:24 am

    Your selector is incorrect: #loginbox .error is selecting all elements with class error contained within the element selected by #loginbox. This works exactly the same way that #loginbox input works – You’re selecting input elements within the #loginbox div.

    To refine a selector with additional class/attribute selectors, you need to chain them together without whitespace. In your specific example, remove the space and use:

    #loginbox.error { ... }
    

    Always remember, seperating your selectors by whitespace means you’re selecting nested tags.

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

Sidebar

Related Questions

I have a simple page that has a (non-Prototype) JavaScript pop-up for login. It
I have a simple web page that till now didn't need any login. It
i have a website that has a simple login form. the form posts to
I have a relatively simple page that has a couple of LI entries that
I have a silverlight app that uses a simple Login.aspx page. I have all
Ok simple question. I have a JSF application, containing a login page. The problem
There are some HTML based games (ie bootleggers.us) that have a simple login form
I have a simple GAE app that includes a login/logout link. This app is
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx.
let's say I have a simple javascript like so: $(document).ready(function(){ if(login == 1) {

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.