如何在背景图像上显示文本

1 html css navigation background-image

我已经成功地将照片设置为我的网站的背景,并让它填充页面,使其固定而不是平铺.现在我希望导航栏出现在图像的中心.但是,尽管我已将图像质量设置为"背景",但导航栏仍隐藏在背景图像后面.如何使其显示在图像的中心.这是我用于图像的编码:

<div>
<table cellspacing="0" cellpadding="0">
    <tr>
        <td>
            <img id="backgroundimage" src="websitebackground.jpg" />
        </td>
    </tr>
</table>
</div>
<style>
body, html { margin:0; padding:0; height:100%; }
#backgroundimage { position:fixed; left:0; top:0; z-index:1; height:100%; width:100%; }
</style>
Run Code Online (Sandbox Code Playgroud)

jmo*_*009 5

除非您显示表格数据,否则不要使用表格.而是做这样的事情

HTML

<div id="backgroundimage">
    //header content goes in here
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

#backgroundimage{
    background-image: url("path-to-image");
    //other styles here
}
Run Code Online (Sandbox Code Playgroud)