: the use of target, only understand-what does sharpbox:target, div:target mean?

what do you mean by div:target+a in the following code style? I understand the "+" sign. I don"t understand why div:target? Shouldn"t target be preceded by the url address of the a tag?

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        a{
            float: left;
            width: 120px;
            height:50px;
            line-height: 50px;
            text-align: center;
            text-decoration: none;
            background: -sharp000;
            color: -sharpfff;
            border:2px solid -sharpfff;

        }
        div{
            position: absolute;
            top:80px;
            width: 300px;
            height:300px;
            background: yellow;
            display: none;
        }
        -sharpbox1:target{
            display: block;
        }
        -sharpbox2:target{
            display: block;
        }
        -sharpbox3:target{
            display: block;
        }
        div:target+a{
            background: red;
        }
    </style>
</head>
<body>

<div id="box1"></div>
<a href="-sharpbox1"></a>

<div id="box2"></div>
<a href="-sharpbox2"></a>

<div id="box3"></div>
<a href="-sharpbox3"></a>
<!--
    :target
        url
-->
</body>
</html>
Feb.28,2021

pseudo-class selector

The

target selector highlights the currently active HTML anchor.

definition and usage
URL followed by the anchor name-sharp, points to a specific element in the document. The linked element is the target element (target element).

: the target selector can be used to select the currently active target element.

all major browsers support: target selector, except for IE8 and earlier versions.

<!DOCTYPE html>
<html>
<head>
<style>
:target
{
border: 2px solid -sharpD4D4D4;
background-color: -sharpe5eecc;
}
</style>
</head>
<body>

<h1></h1>

<a href="-sharpnews1"> 1</a>

<a href="-sharpnews2"> 2</a>

:target HTML

<p id="news1"><b> 1...</b>

<p id="news2"><b> 2...</b>

<b>:</b> Internet Explorer 8 :target

</body> </html>

target pseudo-class you can think of it as "accessed", so if the anchor point in the a tag is hit, then the rule div:target+a means:
if div is accessed, the style of the adjacent an element (+ is the adjacency selector) is blablablabla~

.
Menu