-1

I made my table hidden with display: none; now I want to make it appear with display:block; but it doesn't work.

This is my code in css:

#ArijsLieve{
    background: #333;
    color: white;
    width: 100px;
    text-align: center;
    position: relative;
    top: -300px;
    left: 265px;
    cursor: pointer;
}        
#arijslievetable{
    background: #333;
    color: white;
    width: 200px;
    position: absolute;
    top: 701px;
    left: 273px;
    display: none;
}
#ArijsLieve:hover #arijslievetable{ display: block; }

My html code:

<div id="ArijsLieve">
<h3> Arijs Lieve </h3>
</div>

<table id="arijslievetable">
    <tr>
        <td> Kleuters 3j woensdag </td>
    </tr>
    <tr>
        <td> Kleuters 4j woensdag </td>
    </tr>
    <tr>
        <td> Kleuters 5j woensdag </td>
    </tr>
    <tr>
        <td> Team acro competitie </td>
    </tr>
2
  • I suppose all you need is to override it with display: block !important; but I am not sure if I understood your question correctly... Commented Dec 24, 2014 at 22:31
  • 2
    you want to display a table as a block instead of as a table?. Commented Dec 24, 2014 at 22:34

4 Answers 4

3

The table is the adjacent sibling of the div, not its descendant.

You need an adjacent sibling combinator (+) not a descendant combinator ().

Additionally, a table should be display: table not display: block.

Sign up to request clarification or add additional context in comments.

1 Comment

is it posibol to add one more thing to it? i tryed this but it didnt work. #ArijsLieve:hover ~ #arijslievetable ~ #arijslievefototable { display: block; }
0

Try sibling selector:

#ArijsLieve:hover ~ #arijslievetable{ display: block; }

1 Comment

is it posibol to add one more thing to it? i tryed this but it didnt work. #ArijsLieve:hover ~ #arijslievetable ~ #arijslievefototable { display: block; }
0

try this #ArijsLieve:hover + #arijslievetable{ display: block; } If you want to be able to hover over #ArijsLieve you should delete top:-300px

Comments

-1

You will probably need to use Javascript and need an action. So on click you will want to show your table I assume. Here is a good resource for this idea: JavaScript onClick addClass

What is happening is when you say display none it is hiding it and you need Javascript to replace that class with another class that reads display block.

Hope this helps.

4 Comments

There's no need to use javascript for this.
Sorry the question is confusing, first off he asks to display: none and then he wants to display: block. why not just remove display:none?
He wants the #arijslievetable to show when #ArijsLieve is hovered.
I see missed the hover action item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.