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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:50:29+00:00 2026-05-30T08:50:29+00:00

My html setup is similar to this, the only difference is that my ‘.inner’s

  • 0

My html setup is similar to this, the only difference is that my ‘.inner’s are wrapped much deeper (eg. <div><span><div class="inner">aaa</div></div></span>)

<div class="main">
    <div class="inner">aaa</div>
    <div class="main anOtherClass">
        <div class="inner">aaa</div>
    </div>
</div>

my css is:

.main:hover .inner {
    border: 1px solid #000;
}

The problem is, that if I hover onto the first .main all of my .inners get the border. My goal is only to have the first .inner get the border. Is this even possible to do in css?

  • 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-30T08:50:31+00:00Added an answer on May 30, 2026 at 8:50 am

    Use the child selector:

    .main:hover > .inner {
        border: 1px solid #000;
    }
    

    The > constrains this selector to .inner elements that are a direct child of .main,

    SitePoint explains it well: http://reference.sitepoint.com/css/childselector

    If you’re certain you only want the first one (in case there are two or more adjacent ones) use :first-child as well:

    .main:hover > .inner:first-child {
        border: 1px solid #000;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been battling to get this right...basically I have the following HTML setup: <div
Ive got the following html setup: <div id=div1> <div id=content1>blaat</div> <div id=content1>blaat2</div> </div> it
I have a HTML document with the below setup: <div class=main-div style=padding: 5px; border:
I want to setup a route so that if the user goes to http://mysite.com/page.html
Similar to this question , but my setup is a little different. I've written
Setup: I have an HTML page with a fieldset element. The background color of
I setup custom CSS class for array of dynamic TextBoxes (inputs as HTML) so...
I would like to setup TinyMCE to allow literally any HTML without any cleaning
Just a basic html link question. I have an intranet setup, and I need
I'd like to setup a cron job that checks e.g. every 24 hours to

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.