CSS has no ability to look outside of the currently specified range of selectors, CSS can only cascade down, it cannot traverse back.
As it stands now, you could achieve the desired behaviour, using the adjacent sibling combinator +, with the following selectors: p:hover + img { border-color: #fff; }, without any further amendments to the DOM.
Although, this wouldn't be advised as these selectors are too general and not specific enough, the chances of only having one instance of a img tag following a generic p tag could be slim and unexpected knock-on effects could occur as a result.
Consider the following adjustments in order to have any one of the below specified range of selectors apply and provide the intended behaviour.
a:hover > img { border-color: #fff; }
1. Child Combinator >:
The > combinator selects nodes that are direct children of the first
element
Example:
HTML
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
CSS
.welcome:hover > img {
border-color: white;
}
/* Additional */
.welcome:hover > img {
border-color: white;
}
/* End Additional */
* {
margin: 0;
padding: 0;
}
body {
background-color: rgb(24, 24, 24);
}
.Hero {
position: fixed;
z-index: -1000;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
object-fit: cover;
}
img {
display: block;
width: 940px;
height: 940px;
margin: 0 auto;
position: absolute;
top: 10px;
right: 485px;
z-index: -999;
border: 5px solid transparent;
border-radius: 50%;
}
p {
text-align: center;
font-size: 70px;
margin-top: 415px;
text-shadow: -.75px -.75px 0 #25343f, .75px -.75px 0 #25343f, -.75px .75px 0 #25343f, .75px .75px 0 #25343f;
}
a {
text-decoration: none;
-webkit-transition: all 0.7s;
-moz-transition: all 0.7s;
transition: all .7s;
}
p a {
color: #405c71;
font-family: Pacifico, cursive;
}
p a:hover {
-webkit-animation: neon .9s ease-in-out infinite alternate;
-moz-animation: neon .9s ease-in-out infinite alternate;
animation: neon .65s ease-in-out infinite alternate;
color: #fff;
}
@-webkit-keyframes neon {
from {
text-shadow: 0 0 5px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #405c71, 0 0 70px #405c71, 0 0 80px #405c71, 0 0 100px #405c71, 0 0 150px #405c71;
}
to {
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #405c71, 0 0 35px #405c71, 0 0 40px #405c71, 0 0 50px #405c71, 0 0 75px #405c71;
}
}
<div class="Container">
<!-- <div class="Hero">
<video src="dojo/frontend/photography/images/editor.mp4" preload="auto" autoplay="true" loop="loop"></video>
</div> -->
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
</div>
a:hover + img { border-color: #fff; }
2. Adjacent Sibling Combinator +:
The + combinator selects adjacent siblings. This means that the
second element directly follows the first, and both share the same
parent.
Example:
HTML
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
CSS
.welcome p:hover + img {
border-color: white;
}
/* Additional */
.welcome p:hover + img {
border-color: white;
}
/* End Additional */
* {
margin: 0;
padding: 0;
}
body {
background-color: rgb(24, 24, 24);
}
.Hero {
position: fixed;
z-index: -1000;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
object-fit: cover;
}
img {
display: block;
width: 940px;
height: 940px;
margin: 0 auto;
position: absolute;
top: 10px;
right: 485px;
z-index: -999;
border: 5px solid transparent;
border-radius: 50%;
}
p {
text-align: center;
font-size: 70px;
margin-top: 415px;
text-shadow: -.75px -.75px 0 #25343f, .75px -.75px 0 #25343f, -.75px .75px 0 #25343f, .75px .75px 0 #25343f;
}
a {
text-decoration: none;
-webkit-transition: all 0.7s;
-moz-transition: all 0.7s;
transition: all .7s;
}
p a {
color: #405c71;
font-family: Pacifico, cursive;
}
p a:hover {
-webkit-animation: neon .9s ease-in-out infinite alternate;
-moz-animation: neon .9s ease-in-out infinite alternate;
animation: neon .65s ease-in-out infinite alternate;
color: #fff;
}
@-webkit-keyframes neon {
from {
text-shadow: 0 0 5px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #405c71, 0 0 70px #405c71, 0 0 80px #405c71, 0 0 100px #405c71, 0 0 150px #405c71;
}
to {
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #405c71, 0 0 35px #405c71, 0 0 40px #405c71, 0 0 50px #405c71, 0 0 75px #405c71;
}
}
<div class="Container">
<!-- <div class="Hero">
<video src="dojo/frontend/photography/images/editor.mp4" preload="auto" autoplay="true" loop="loop"></video>
</div> -->
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
</div>
a:hover ~ img { border-color: #fff; }
3. General Sibling Combinator ~:
The ~ combinator selects siblings. This means that the second
element follows the first (though not necessarily immediately), and
both share the same parent.
Example:
HTML
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<p>arbitrary element</p>
<p>another arbitrary element</p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
CSS
.welcome p:hover ~ img {
border-color: white;
}
/* Additional */
.welcome p:hover ~ img {
border-color: white;
}
/* End Additional */
* {
margin: 0;
padding: 0;
}
body {
background-color: rgb(24, 24, 24);
}
.Hero {
position: fixed;
z-index: -1000;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
object-fit: cover;
}
img {
display: block;
width: 940px;
height: 940px;
margin: 0 auto;
position: absolute;
top: 10px;
right: 485px;
z-index: -999;
border: 5px solid transparent;
border-radius: 50%;
}
p {
text-align: center;
font-size: 70px;
margin-top: 415px;
text-shadow: -.75px -.75px 0 #25343f, .75px -.75px 0 #25343f, -.75px .75px 0 #25343f, .75px .75px 0 #25343f;
}
a {
text-decoration: none;
-webkit-transition: all 0.7s;
-moz-transition: all 0.7s;
transition: all .7s;
}
p a {
color: #405c71;
font-family: Pacifico, cursive;
}
p a:hover {
-webkit-animation: neon .9s ease-in-out infinite alternate;
-moz-animation: neon .9s ease-in-out infinite alternate;
animation: neon .65s ease-in-out infinite alternate;
color: #fff;
}
@-webkit-keyframes neon {
from {
text-shadow: 0 0 5px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #405c71, 0 0 70px #405c71, 0 0 80px #405c71, 0 0 100px #405c71, 0 0 150px #405c71;
}
to {
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #405c71, 0 0 35px #405c71, 0 0 40px #405c71, 0 0 50px #405c71, 0 0 75px #405c71;
}
}
<div class="Container">
<!-- <div class="Hero">
<video src="dojo/frontend/photography/images/editor.mp4" preload="auto" autoplay="true" loop="loop"></video>
</div> -->
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a></p>
<p>arbitrary element</p>
<p>another arbitrary element</p>
<img class="logo" src="https://placehold.it/940x940" alt="">
</div>
</div>
a:hover img { border-color: #fff; }
4. Descendant Combinator :
The combinator selects nodes that are descendants of the first
element.
Example:
HTML
<div class="welcome">
<p><a href="dojo/frontend/photography/index.html">Welcome</a>
<img class="logo" src="https://placehold.it/940x940" alt="">
</p>
</div>
CSS
.welcome p:hover img {
border-color: white;
}
/* Additional */
.welcome p:hover img {
border-color: white;
}
/* End Additional */
* {
margin: 0;
padding: 0;
}
body {
background-color: rgb(24, 24, 24);
}
.Hero {
position: fixed;
z-index: -1000;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
object-fit: cover;
}
img {
display: block;
width: 940px;
height: 940px;
margin: 0 auto;
position: absolute;
top: 10px;
right: 485px;
z-index: -999;
border: 5px solid transparent;
border-radius: 50%;
}
p {
text-align: center;
font-size: 70px;
margin-top: 415px;
text-shadow: -.75px -.75px 0 #25343f, .75px -.75px 0 #25343f, -.75px .75px 0 #25343f, .75px .75px 0 #25343f;
}
a {
text-decoration: none;
-webkit-transition: all 0.7s;
-moz-transition: all 0.7s;
transition: all .7s;
}
p a {
color: #405c71;
font-family: Pacifico, cursive;
}
p a:hover {
-webkit-animation: neon .9s ease-in-out infinite alternate;
-moz-animation: neon .9s ease-in-out infinite alternate;
animation: neon .65s ease-in-out infinite alternate;
color: #fff;
}
@-webkit-keyframes neon {
from {
text-shadow: 0 0 5px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #405c71, 0 0 70px #405c71, 0 0 80px #405c71, 0 0 100px #405c71, 0 0 150px #405c71;
}
to {
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #405c71, 0 0 35px #405c71, 0 0 40px #405c71, 0 0 50px #405c71, 0 0 75px #405c71;
}
}
<div class="Container">
<!-- <div class="Hero">
<video src="dojo/frontend/photography/images/editor.mp4" preload="auto" autoplay="true" loop="loop"></video>
</div> -->
<div class="welcome">
<p>
<a href="dojo/frontend/photography/index.html">Welcome</a>
<img class="logo" src="https://placehold.it/940x940" alt="">
</p>
</div>
</div>
More on CSS Selectors