Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

How to set a background image in HTML?

In HTML, adding a background image to your website is simple. You can use the HTML style attribute and the CSS background-image property.


<style>
body {
  background-image: url('lambdatest.png');
}
</style>

Following is the code for adding the background image on an HTML element.


<!DOCTYPE html>
<html>
<body>

<h2>Background Image</h2>

<p>A background image for a p element:</p>

<p style="background-image: url('lambdatest.png');">
Perform both manual <br>
and automated testing <br>
for websites <br>
and mobile applications.
</p>

</body>
</html>

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free