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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:37:03+00:00 2026-06-05T12:37:03+00:00

I want to show text and when the user hovers this text he should

  • 0

I want to show text and when the user hovers this text he should see an input form instead of the text.
When it’s unhovered, it’s replaced by the text again.
But if the user focuses the input form, the input form should stay even if it’s unhovered.

The problem is that if it’s unhovered but the input form is focused, the input form AND the text element are visible (the text element should be hidden).

I’m using this HTML code

<div class="editable">
  <span>hello</span>
  <input value="hello" />
</div>

and this css for this:

.editable :last-child { display: none; }

.editable:hover > :first-child { display: none; }
.editable:hover > :last-child { display: block; }

.editable > :last-child:focus { display: block; }
.editable > :last-child:focus~:first-child { display: none; } // <- this doesn't work!

JSfiddle here: http://jsfiddle.net/a8U3P/

Does anybody have a clue why this doesn’t work?

EDIT: I tried Firefox 13 and Chromium

  • 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-06-05T12:37:05+00:00Added an answer on June 5, 2026 at 12:37 pm

    The general sibling combinator, E ~ F, matches an F element preceded by an E element. “Preceded” means that the E element comes before the F element.

    How exactly do you expect a first child to be preceded by a last child? By the definition of “first” and “last,” this cannot match any elements, ever.

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

Sidebar

Related Questions

I want to show an unicode text in my sdl program , but it
I want to show a dialog to the user that says this is going
I've a user registration form and I want to show the password rules in
I have a text box in an HTML form where the user will input
I want to show a PDF in browser, from which user can select text,
I just want to show text please wait while app is searching for satellite
I am using infragistic's ultragrid and I want to show the text portion of
I am using Delphi, and I want to show custom text in the buttons
I'm using jquery validate to validate my forms. I want to show a text
if i want to have some text show up in a calligraphy font, how

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.