Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to set all the background properties in one declaration with JavaScript DOM?
To set the background in JavaScript, use the background property. It allows you to set the background color, image, position, etc.
Example
You can try to run the following code to learn how to set all the background properties in a single declaration with JavaScript.
<!DOCTYPE html>
<html>
<body>
<button onclick="display()">Click to Set background</button>
<script>
function display() {
document.body.style.background = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg') repeat right top";
}
</script>
</body>
</html> Advertisements
