I'm using :target in html and I code something like that:
<div class="1">
    <div>
       <ul>
          <a href="#2">link to part 2</a>
       </ul>
    </div>
    <div class="ex">
        <ul id="2">
           <p>hi</p>
        </ul> 
    </div>
and I've done this in css:
.ex ul {
    display: none;
 }
 .ex ul:target {
    display: block;
 }
I need to make so that when you click on the link (in this case the words 'link to part 2') the #2 ul show, (alredy done this) and the ul whit the link disappears, how can I do?
 
     
    
element, it can only contain-  elements. So your code should either put the contents inside 
-  elements in both 
– Mr Lister Dec 31 '19 at 13:36s, or remove the
s. See chris' answer for links.