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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:04:49+00:00 2026-06-04T20:04:49+00:00

I’m trying to do a sort of pure html/css tabs system. I have <div>

  • 0

I’m trying to do a sort of pure html/css tabs system. I have

<div>
    <input class="tab1" type="radio" checked/>
    <input class="tab2" type="radio"/>
</div>

<div class="content">
    <div class="tab-1">

    </div>
    <div class="tab-2">

    </div>
</div>

And my css

.content > div {
    opacity:0;
}

input.tab1:checked ~ .tab-1, input.tab2:checked ~ .tab-2  {
    opacity: 1
}

However the tilde ~ isnt working as its supposed to (because the divs aren’t exactly a sibling) – How can I get the css to sort of work across to other nodes? Is there a way of ‘saying’ and 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-06-04T20:04:51+00:00Added an answer on June 4, 2026 at 8:04 pm

    You would have to go up one level and you cannot do that in CSS as there is no parent selector in CSS. You might want to read this article: why we don’t have a parent selector in CSS (there will be a parent selector in CSS4, however)

    What you can do:

    Option 1: change your HTML:

    .a

    <input class="tab1" type="radio" checked/>
    <input class="tab2" type="radio"/>
    
    <div class="content">
        <div class="tab-1"></div>
        <div class="tab-2"></div>
    </div>
    

    and use input.tab1:checked ~ .content .tab-1

    .b Try a structure like described here: http://css-tricks.com/functional-css-tabs-revisited/ – basically, the idea is that you don’t make a group of tabs and a group of tab contents, but you group each tab with its corresponding content.

    Option 2: use JavaScript (which goes against the idea of a pure CSS tab system, it’s true)


    Important note: keep in mind that setting opacity < 0 on a parent node makes all the children have the same opacity value and there is nothing you can do to change that (except setting the opacity of the parent to 1 again 😛 ).

    • 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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.