我想添加背景图片

I would like to add a backgound image

我的页面与我希望的完全一样。现在看着它,我希望我能添加一个背景图像。有没有简单的方法解决这个问题。我知道代码可能看起来有点滑稽,但这就是 Spiceworks 纠正代码的方式。

<div style="text-align: center;">
<p style="font-size: 30px;">&nbsp;</p>

<p style="font-size: 30px;"><span style="color:rgb(0, 128, 0)"><strong>WELCOME TO PARK CITY CREDIT UNION&rsquo;s I.T. TICKET SYSTEM!</strong></span></p>
</div>

<div style="text-align: center;">
<p><span style="color:rgb(0, 0, 0)"><strong>Please do not email or chat, if you do so, you will be directed to open a ticket!</strong></span></p>
</div>

<div style="text-align: center;">
<p><strong>NEED IMMEDIATE ASSISTANCE and unable to reach I.T.??</strong> <strong>Call Locknet 1-877-408-1656&nbsp;&nbsp;</strong></p>

<p><em>Note - Any tickets submitted after 4:00 PM may not get a response until the next business day</em>.</p>

<p>&nbsp;</p>
</div>

<p style="font-size: 17px;"><strong>&nbsp;The Ticket System is a new platform to better serve you as well as enable a more efficient way to support your IT needs in an appropriate prioritized order.</strong></p>

<p>&nbsp;</p>

<p style="font-size: 15px;"><strong><span style="text-decoration:underline">NEED HELP? We are here for you!</span></strong></p>

<p style="font-size: 14px;">Click on the <em>&ldquo;New Ticket&rdquo;</em>&nbsp; Tab and create your ticket. If your ticket has not been started/resolved within 3 hours, please contact IT.</p>

<hr />
<p style="font-size: 15px;"><span style="text-decoration:underline"><strong><em>How do I know my ticket came through?</em></strong></span></p>

<p style="font-size: 14px;">- You will receive an email from <em>spiceworks@parkcitycu.org</em></p>

<p style="font-size: 14px;">-You will receive a second email letting you know who is working on your ticket</p>

<p style="font-size: 14px;">- You may recieve a phone call if your ticket requires follow up</p>

<hr />

您应该使用 CSS 设置背景图片。

<style>
    body {
        background-image: url("BACKGROUND_IMAGE_URL_HERE");
    }
</style>

是否要在整个页面上添加背景图片?如果是,您应该使用 CSS 设置背景图像:

<style>
    body {
        background-image: url("IMAGE-PATH-HERE");
    }
</style>

IMAGE-PATH-HERE 应该指向您的图像文件。例如,您可以将图像复制到 HTML 文件所在的同一文件夹,并指定图像名称和扩展名 - 例如

<style>
    body{
        background-image:url("myimage.jpg");
    } 
</style>

如果图像位于单独的 folder/directory 上,则还要指定目录路径 - 例如

<style>
    body{
        background-image:url("assets/myimage.jpg");
    } 
</style>

希望对您有所帮助

我编辑了您的代码(并更正了一个拼写错误)。非常简单的修复:

<body style="background-image: url(http://lorempixel.com/1024/1024/); background-repeat: no-repeat; background-size: cover;">

<div style="text-align: center;">
<p style="font-size: 30px;">&nbsp;</p>

<p style="font-size: 30px;"><span style="color:rgb(0, 128, 0)"><strong>WELCOME TO PARK CITY CREDIT UNION&rsquo;s I.T. TICKET SYSTEM!</strong></span></p>
</div>

<div style="text-align: center;">
<p><span style="color:rgb(0, 0, 0)"><strong>Please do not email or chat, if you do so, you will be directed to open a ticket!</strong></span></p>
</div>

<div style="text-align: center;">
<p><strong>NEED IMMEDIATE ASSISTANCE and unable to reach I.T.??</strong> <strong>Call Locknet 1-877-408-1656&nbsp;&nbsp;</strong></p>

<p><em>Note - Any tickets submitted after 4:00 PM may not get a response until the next business day</em>.</p>

<p>&nbsp;</p>
</div>

<p style="font-size: 17px;"><strong>&nbsp;The Ticket System is a new platform to better serve you as well as enable a more efficient way to support your IT needs in an appropriate prioritized order.</strong></p>

<p>&nbsp;</p>

<p style="font-size: 15px;"><strong><span style="text-decoration:underline">NEED HELP? We are here for you!</span></strong></p>

<p style="font-size: 14px;">Click on the <em>&ldquo;New Ticket&rdquo;</em>&nbsp; Tab and create your ticket. If your ticket has not been started/resolved within 3 hours, please contact IT.</p>

<hr />
<p style="font-size: 15px;"><span style="text-decoration:underline"><strong><em>How do I know my ticket came through?</em></strong></span></p>

<p style="font-size: 14px;">- You will receive an email from <em>spiceworks@parkcitycu.org</em></p>

<p style="font-size: 14px;">-You will receive a second email letting you know who is working on your ticket</p>

<p style="font-size: 14px;">- You may receive a phone call if your ticket requires follow up</p>

</body>

显然,您需要更改图像,但这段代码有适合您的背景图像。另外,我建议您以不同的方式格式化代码,因为它当前的格式化方式有点难以阅读。如果您打算为 Web 编程(HTML、CSS、Javascript 等),我建议您使用括号 IDE。它不是用于格式化,但我喜欢它。

无论如何,GLHF!