How to target the href to div using CSS?
CSS

How to target the href to div using CSS?

0 64

HTML Code

<table border="0">
          <tr>
            <td>
              <hr>
              <a href="#t1">
                Link 1
              </a>
              <br>
              <hr>
              <a href="#t2">
                Link 2
              </a>
              <br>
              <hr>
              <a href="#t3">
                Link 3
              </a>
              <br>
              <hr>
            </td>
          </tr>
        </table>

<div class="target">
    <div id="t1">
        Data of Test Link 1
    </div>
    <div id="t2">
        Data of Test Link 2
    </div>
    <div id="t3">
        Data of Test Link 3
    </div>
</div>

 

CSS Code

a{
    text-decoration:none;
    color:black;
}
.target {
    width:50%;
    height:200px;
    border:solid black 1px; 
}
.target > div {
    display:none;
}

.target > div:target{
    display:block;
}

About the author / 

codeadmin

Leave a reply

Your email address will not be published. Required fields are marked *

*