Right now I am having trouble placing a paragraph behind a background image. I have tried using z-index and position relative, but have not found any success. How could I do this?
.pageone {
background-image: url(headerhalf.png);
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
width: 100vw;
height: 100vh;
}
#aboutme {
text-align: center;
font-size: 5vw;
margin-top: 6vh;
color: #81af66;
text-shadow: 2px 2px 3px rgba(129, 131, 131, 0.25);
}
.pagecontainer {
width: 50vw;
height: 100vh;
display: flex;
justify-content: center;
}
#aboutcopy {
font-size: 1.25vw;
margin: 1.5em;
}
<div class="pageone">
<div class="pagecontainer">
<div class="aboutreal">
<p id="aboutme">About Me</p>
<p id="aboutcopy">I run a YouTube channel on which I benchmark the performance of computer hardware. I've been uploading content to YouTube for upwards of one year, and have amassed over 80 thousand views in that time period. While I'm not managing my channel I design graphics for others and myself. I design product advertisements, avatars and banners for YouTube, websites, logos, and more. I am comfortable with a wide variety of softwares such as: Adobe Photoshop, Adobe After Effects, Adobe Premiere Pro and, Unreal Engine 4. I am also learning HTML and CSS.</p>
</div>
</div>
</div>
Here is a link to the site: site
Thanks!
2
Answers
Try the CSS
:after
selector:The problem is that your trying put an element behind its parent element, which is not possible in the regular page flow. One option is create another
<div>
at the same level of the about element and put the image there:I think that it could be possible achieve this without using absolute positioning, but this method is quite straightforward.