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

  • Home
  • SEARCH
  • 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 7032749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:58:31+00:00 2026-05-28T00:58:31+00:00

I’m trying to use javascript as little as possible on this project. I would

  • 0

I’m trying to use javascript as little as possible on this project. I would like to create a a voting thing on my site, with stars.

I will have 5 stars, sort of faded out, and when the user rolls over the first, the first will light up, and then they roll over the second, both the second and first light up, until they reach the fifth star, when all stars will be lit.

I tried surrounding them with div tags, so that they would be grouped, but it made all five stars light up every time.

I tried adjusting the z-index of the groups, so that I could hover over the first stars first, but that didn’t work either.

Perhaps this can’t be done in CSS, but I feel like there should be some shortcut to it. Let me know if you can think of anything.

Here’s the JSFiddle that I’m working off of: Working sample

HTML

<div class="clearfix" id="stars">
    <div class="darn">Oh no!</div>
    <div class="star off"></div>
    <div class="star off"></div>
    <div class="star off"></div>
    <div class="star off"></div>
    <div class="star off"></div>
    <div class="brilliant">Thanks!</div>
</div>

CSS

.clearfix div {
    float:left;
    position:relative;
}

#stars {
    width:450px;
    margin:0 auto;
}

.star {
    width:64px;
    height:64px;
    background:url(http://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Full_Star_Blue.svg/64px-Full_Star_Blue.svg.png) no-repeat;
 }

.star:hover {
    background:url(https://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/Full_Star_Yellow.svg/64px-Full_Star_Yellow.svg.png) no-repeat;
    cursor:pointer;
}

.group {
    position:absolute
}
  • 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-28T00:58:32+00:00Added an answer on May 28, 2026 at 12:58 am

    If I understood you right, this grouping of divs inside div might work (only FF tested, though, but you get the picture)
    http://jsfiddle.net/LL9pH/1/

    [edit] fixed the text positioning still, http://jsfiddle.net/LL9pH/3/

    HTML

    <div class="clearfix" id="stars">
        <div class="darn">Oh no!</div>
        <div class="star off">
            <div class="star off">
                <div class="star off">
                    <div class="star off">
                        <div class="star off"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="brilliant">Thanks!</div>
    </div>
    

    CSS

    .star .star { 
        margin-left: 70px;
    }
    
    .brilliant {
        margin-left: 400px;
        margin-top: -64px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.