Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Text not showing over Image

Tags:

html

css

My text/header is not showing over my image which I'm trying to use as a background to this webpage. This is the code I have right now:

HTML:

<body id="body">

    <div id="navbar">
         <h1 id="name">Lorem ipsum</h1>
        <img class="backgroundimg" src="leaf.jpg" alt="A leaf"/>

    </div>


    <div class="backimg">
    <img class="backgroundimg" src="buildings.jpg"/>
    </div>

    <div class="backimg">
    <img class="backgroundimg" src="squares.jpg"/>
    </div>

</body>

CSS:

 body {
    background-color:black
}


 backgroundimg {
    position:relative;
    width:1175px;

}

 name {
    position:absolute;
    color: white;
    z-index;
}

Any tips? P.S. I took out the '#' and '.' to the appropriate names in CSS.

like image 844
AddisonDevelops Avatar asked Apr 27 '26 13:04

AddisonDevelops


1 Answers

Use z-index to show the text over image.

like image 192
Anil Panwar Avatar answered Apr 30 '26 05:04

Anil Panwar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!