3

Is there a way to target a parent class in CSS?

<div class="accountarea">
    <a class="auglink" href="/account">
        Account <i class="fa fa-angle-down icon-right"></i>
    </a>
    <div class="accountappear">
        <div class="accountforce">
            You are not logged in to an account.
            <form action="account.php" method="post">
                <input type="text" name="email" placeholder="E-mail Address" />
                <input type="password" name="password" placeholder="Password" />
                <input type="submit" name="login" value="Log In" class="minisubmit" />
            </form>
        </div>
        <div class="accountbottom">
            ddd
        </div>
    </div>
</div>

I need it so that if any input field in accountarea is on focus (:focus), then accountarea should stay visible (it's currently set to go visible on hover - I need both).

Joe Kennedy
  • 8,605
  • 7
  • 38
  • 51
invidious
  • 231
  • 1
  • 4
  • 11

1 Answers1

2

There isn't a way to select the parent element with CSS right now.

Using JavaScript is currently your best option.

If jQuery is already loaded on your page see the docs on Tree Traversal

bob
  • 953
  • 12
  • 19